Registry / observability / pino-sentry

pino-sentry

JSON →
library0.15.0jsnpmunverified

A transport (stream) for the pino logger that sends logs to Sentry via @sentry/node. Current stable version 0.15.0 supports pino v7+ and Sentry SDK v7. It works as a CLI tool or programmatic stream, exposing both createWriteStream and the Sentry instance directly. Release cadence is sporadic. Key differentiators: lightweight, simple integration, and exposes the underlying Sentry instance for advanced usage. Requires Node >=10 and @sentry/node as a peer dependency. Self-hosted Sentry users must be on 20.6.0+ with Sentry SDK v7.

npm install pino-sentry
INSTALL
IMPORT
SIG · PINO-SENTRY
P
pino-sentry
observabilityjavascriptv0.15.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

createWriteStream
✓ import { createWriteStream } from 'pino-sentry'
✗ const createWriteStream = require('pino-sentry').createWriteStream
ESM default export is not available; use named import. In CJS, destructure from require().
Sentry
✓ import { Sentry } from 'pino-sentry'
✗ const Sentry = require('pino-sentry').default
Sentry is a named export, not default. In CJS, use destructuring.
Severity
✓ import { Severity } from 'pino-sentry'
✗ const Severity = require('pino-sentry')
Severity is a named export. In CJS, destructure it.
createWriteStream via CJS require
✓ const { createWriteStream } = require('pino-sentry')
✗ const createWriteStream = require('pino-sentry').default
There is no default export in CommonJS; must destructure from the module.

Configures pino-sentry with a DSN and pino instance, logs a message and an error sent to Sentry.

import { createWriteStream } from 'pino-sentry'; import pino from 'pino'; const stream = createWriteStream({ dsn: process.env.SENTRY_DSN ?? '', environment: process.env.NODE_ENV ?? 'production', level: 'info', maxBreadcrumbs: 50, }); const logger = pino({ level: 'info' }, stream); logger.info({ msg: 'Hello from pino-sentry' }); logger.error({ err: new Error('Test error') }, 'Error occurred');
Debug
Known issues
gotchaThe Sentry SDK v7 requires self-hosted Sentry 20.6.0+. Older on-premise versions will fail.
fix
Upgrade sentry self-hosted to 20.6.0+ or use pino-sentry versions prior to 0.15.0 with Sentry SDK v6.
affects: >=0.15.0
gotchaCLI usage (pipe to pino-sentry) must call with --dsn or set SENTRY_DSN environment variable, otherwise it throws error.
fix
Provide DSN via --dsn flag or SENTRY_DSN env var.
affects: >=0.0.0
deprecatedThe 'sampleRate' option as a percentage (0.0-1.0) is deprecated; use the 'tracesSampleRate' option directly on Sentry.init if needed.
fix
Replace sampleRate with 'tracesSampleRate' in Sentry.init (outside pino-sentry options).
affects: >=0.15.0
breakingBreaking change in v0.15.0: Removed support for @sentry/node v6. Only v7 is supported.
fix
Update @sentry/node to v7.x and ensure self-hosted Sentry >=20.6.0.
affects: >=0.15.0
Errors
Common errors & fixes
Cannot find module '@sentry/node'
Missing peer dependency @sentry/node.
fix
Install it: npm install @sentry/node
Sentry SDK version mismatch: expected v7 but got v6
Installed @sentry/node is v6, pino-sentry v0.15 requires v7.
fix
Upgrade @sentry/node to version ^7.0.0
TypeError: createWriteStream is not a function
Incorrect import: using default import instead of named import.
fix
Use import { createWriteStream } from 'pino-sentry'
Error: No DSN provided. Set SENTRY_DSN environment variable or pass --dsn
DSN is missing when using the CLI or creating the stream without setting 'dsn' option.
fix
Set SENTRY_DSN env var or pass dsn option to createWriteStream.
Upgrade
Version history
0.15.0latest on npm
Audit
Dependencies
@sentry/noderequiredPeer dependency for Sentry integration; must be installed separately.
Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
2
Resources
pino-sentry — npm install pino-sentry · libregistry