Framework guide
Error tracking for Node.js
For Node.js servers Belvador uses the official Sentry SDK with your Belvador DSN, plus init options and a scrubbing hook that strip request bodies, cookies and credentials before anything leaves your server.
The short answer#
Use the official
@sentry/nodeSDK with your Belvador DSN.Belvador's init options and scrubbing hook strip request bodies, cookies and credentials before sending.
Cron jobs report check-ins with
Sentry.withMonitor(), and OpenTelemetry traces link to errors.This is a compatibility setup: Belvador tests its hook, not the Sentry SDK itself.
Install#
npm install @sentry/node@11.9.0 @belvador/core@0.6.1Create instrument.mjs#
import * as Sentry from "@sentry/node";import { scrubBreadcrumb, scrubEvent } from "@belvador/core/sentry";Sentry.init({ dsn: process.env.BELVADOR_DSN ?? "https://<public-key>@ingest.belvador.dev/<project-id>", release: process.env.APP_VERSION, environment: process.env.NODE_ENV, sendDefaultPii: false, tracesSampleRate: 0, maxBreadcrumbs: 50, maxValueLength: 8192, // Belvador's scrubbing: request bodies, cookies and credentials never leave the app. beforeSend: scrubEvent, beforeBreadcrumb: scrubBreadcrumb,});Load it first#
node --import ./instrument.mjs server.jsLoading the file before your app lets the SDK instrument your framework. The Node.js guide explains every option.
What this setup is#
A compatibility setup, not a Belvador package. Belvador's tests run the scrubbing hook on hostile data, but Belvador does not certify @sentry/node itself or its framework integrations. Your node scrubs again before storing anything (data protection).
Cron jobs and workers#
import * as Sentry from "@sentry/node";await Sentry.withMonitor("nightly-invoices", async () => { // Your job.}, { schedule: { type: "crontab", value: "0 2 * * *" }, timezone: "UTC" });A job that fails, runs too long or never starts opens an incident (cron monitoring).
Traces and logs#
Add the OpenTelemetry Node SDK with the standard OTLP exporter; with Sentry and OpenTelemetry together, errors carry the trace id of the request they happened in (OpenTelemetry for Node.js).
Tested on 2026-10-24 with node 22.23.4, @opentelemetry/sdk-node 0.300.0, @opentelemetry/auto-instrumentations-node 0.82.0, pino 10.4.0: traces passed, logs passed, logs carry the request's trace and span.
Limits#
Supported Node.js versions follow the current
@sentry/noderelease.No profiling and no performance dashboards; traces are kept for debugging.
Questions#
Can I keep sending to Sentry while I test?#
Yes, with a second SDK client or a second environment. Switching back is a DSN change.
Posts on this topic
All posts- Secrets in exception messages: what the Node SDK sends by defaultAPI keys, tokens and webhook URLs end up in error messages. We tested 15 real cases with @sentry/node defaults and two scrubbers: what leaked, and why.
- JavaScript error handling for AI-generated apps: where errors escapeWhere JavaScript errors escape in React and Node.js: a lab with 13 failure cases, three runs each, and the few lines that make each one visible.
Try it on your own Hetzner project
Free during the beta. Hetzner bills the server; Belvador never bills per event.