Registry / observability / winston-transport-sentry-node

winston-transport-sentry-node

JSON →
library3.0.0jsnpmunverified

Winston v3 transport for sending logs to Sentry using @sentry/node. Version 3.0.0 requires @sentry/node >= 8.13.0. It integrates Sentry's error tracking and context (tags, user, extras) into the winston logging pipeline. Supports log level mapping, custom formats, and silent mode. Ships TypeScript types. Released under MIT license.

npm install winston-transport-sentry-node
INSTALL
IMPORT
SIG · WINSTON-TRANSPORT-
W
winston-transport-sentry-node
observabilityjavascriptv3.0.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 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' } });
Debug
Known issues
breakingVersion 3.0.0 requires @sentry/node >= 8.13.0 (breaking change from earlier versions)
fix
Upgrade @sentry/node to ^8.13.0 or downgrade winston-transport-sentry-node to 2.x
affects: >=3.0.0 <3.0.0
breakingVersion 3.0.0 drops support for Node.js < 8.10.0
fix
Upgrade Node.js to 8.10.0 or later
affects: >=3.0.0 <3.0.0
deprecatedDeprecated: winston-transport-sentry-node now uses @sentry/node v8 which has breaking API changes. Sentry.init() is now required before using the transport.
fix
Initialize Sentry globally with Sentry.init() and pass empty sentry option object to the transport
affects: >=3.0.0
gotchaDefault import requires .default in CommonJS. Many users mistakenly use named import or omit .default.
fix
Use const SentryTransport = require('winston-transport-sentry-node').default;
affects: >=1.0.0
gotchaTransport expects sentry option object. If omitted, it will default to reading from process.env, which may cause silent failures.
fix
Always provide a sentry option object (can be empty) to avoid unexpected behavior
affects: >=2.0.0 <3.0.0
Errors
Common errors & fixes
TypeError: winston_transport_sentry_node_1.default is not a constructor
CommonJS require without .default
fix
const 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
fix
Add 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
fix
Remove '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
fix
Ensure you use default import: new (require('winston-transport-sentry-node').default)({...})
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
@sentry/noderequiredpeer dependency for Sentry SDK functionality
winstonrequiredpeer dependency for winston logger
Agent activity
45 hits · last 30 days
node
36
OpenAI (training)
1
Resources
winston-transport-sentry-node — npm install winston-transport-sentry-node · libregistry