Registry /
observability / winston-transport-sentry-node
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import SentryTransport from 'winston-transport-sentry-node'
✗ import { default } from 'winston-transport-sentry-node'
The package exports a default class. Use default import in ESM. CommonJS: const SentryTransport = require('winston-transport-sentry-node').default;
SentryTransport
✓ import SentryTransport from 'winston-transport-sentry-node'
✗ import { SentryTransport } from 'winston-transport-sentry-node'
No named export; always use default import.
Transport
✓ import Transport from 'winston-transport-sentry-node'
✗ const Transport = require('winston-transport-sentry-node')
CommonJS users must call .default on require result.
Initialize Sentry globally, create a winston logger with the Sentry transport, and log an error with tags sent to Sentry.
import winston from 'winston';
import SentryTransport from 'winston-transport-sentry-node';
import * as Sentry from '@sentry/node';
Sentry.init({
dsn: process.env.SENTRY_DSN || '',
});
const logger = winston.createLogger({
transports: [
new SentryTransport({
sentry: {},
level: 'error',
}),
],
});
logger.info('This will not be sent to Sentry (level info)');
logger.error('This will be sent to Sentry', { tags: { route: '/api' } });
Errors
Common errors & fixes
TypeError: winston_transport_sentry_node_1.default is not a constructor
CommonJS require without .default
fixconst SentryTransport = require('winston-transport-sentry-node').default; Error: @sentry/node has not been initialized. Please call Sentry.init() first.
Forgetting to call Sentry.init() before using the transport
fixAdd Sentry.init({ dsn: 'https://...@...' }); before creating the transport TypeError: Cannot destructure property 'Sentry' of 'undefined' or 'null'
Older versions expected Sentry as an option in sentry object
fixRemove 'Sentry' property from sentry options and import/require @sentry/node separately
AggregateError: The transport is not a valid transport, expected a Transport instance or a function returning a Transport
Importing wrong export (named instead of default) in winston.add
fixEnsure you use default import: new (require('winston-transport-sentry-node').default)({...}) Audit
Dependencies
@sentry/noderequiredpeer dependency for Sentry SDK functionality
winstonrequiredpeer dependency for winston logger