{"id":20263,"library":"pino-sentry","title":"pino-sentry","description":"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.","status":"active","version":"0.15.0","language":"javascript","source_language":"en","source_url":"https://github.com/aandrewww/pino-sentry","tags":["javascript","logger","loggly","logging","node","tools","sentry","transport","pino","typescript"],"install":[{"cmd":"npm install pino-sentry","lang":"bash","label":"npm"},{"cmd":"yarn add pino-sentry","lang":"bash","label":"yarn"},{"cmd":"pnpm add pino-sentry","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for Sentry integration; must be installed separately.","package":"@sentry/node","optional":false}],"imports":[{"note":"ESM default export is not available; use named import. In CJS, destructure from require().","wrong":"const createWriteStream = require('pino-sentry').createWriteStream","symbol":"createWriteStream","correct":"import { createWriteStream } from 'pino-sentry'"},{"note":"Sentry is a named export, not default. In CJS, use destructuring.","wrong":"const Sentry = require('pino-sentry').default","symbol":"Sentry","correct":"import { Sentry } from 'pino-sentry'"},{"note":"Severity is a named export. In CJS, destructure it.","wrong":"const Severity = require('pino-sentry')","symbol":"Severity","correct":"import { Severity } from 'pino-sentry'"},{"note":"There is no default export in CommonJS; must destructure from the module.","wrong":"const createWriteStream = require('pino-sentry').default","symbol":"createWriteStream via CJS require","correct":"const { createWriteStream } = require('pino-sentry')"}],"quickstart":{"code":"import { createWriteStream } from 'pino-sentry';\nimport pino from 'pino';\n\nconst stream = createWriteStream({\n  dsn: process.env.SENTRY_DSN ?? '',\n  environment: process.env.NODE_ENV ?? 'production',\n  level: 'info',\n  maxBreadcrumbs: 50,\n});\n\nconst logger = pino({ level: 'info' }, stream);\n\nlogger.info({ msg: 'Hello from pino-sentry' });\nlogger.error({ err: new Error('Test error') }, 'Error occurred');","lang":"typescript","description":"Configures pino-sentry with a DSN and pino instance, logs a message and an error sent to Sentry."},"warnings":[{"fix":"Upgrade sentry self-hosted to 20.6.0+ or use pino-sentry versions prior to 0.15.0 with Sentry SDK v6.","message":"The Sentry SDK v7 requires self-hosted Sentry 20.6.0+. Older on-premise versions will fail.","severity":"gotcha","affected_versions":">=0.15.0"},{"fix":"Provide DSN via --dsn flag or SENTRY_DSN env var.","message":"CLI usage (pipe to pino-sentry) must call with --dsn or set SENTRY_DSN environment variable, otherwise it throws error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Replace sampleRate with 'tracesSampleRate' in Sentry.init (outside pino-sentry options).","message":"The 'sampleRate' option as a percentage (0.0-1.0) is deprecated; use the 'tracesSampleRate' option directly on Sentry.init if needed.","severity":"deprecated","affected_versions":">=0.15.0"},{"fix":"Update @sentry/node to v7.x and ensure self-hosted Sentry >=20.6.0.","message":"Breaking change in v0.15.0: Removed support for @sentry/node v6. Only v7 is supported.","severity":"breaking","affected_versions":">=0.15.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Install it: npm install @sentry/node","cause":"Missing peer dependency @sentry/node.","error":"Cannot find module '@sentry/node'"},{"fix":"Upgrade @sentry/node to version ^7.0.0","cause":"Installed @sentry/node is v6, pino-sentry v0.15 requires v7.","error":"Sentry SDK version mismatch: expected v7 but got v6"},{"fix":"Use import { createWriteStream } from 'pino-sentry'","cause":"Incorrect import: using default import instead of named import.","error":"TypeError: createWriteStream is not a function"},{"fix":"Set SENTRY_DSN env var or pass dsn option to createWriteStream.","cause":"DSN is missing when using the CLI or creating the stream without setting 'dsn' option.","error":"Error: No DSN provided. Set SENTRY_DSN environment variable or pass --dsn"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}