Node.js error tracking
Node.js error tracking with per-request context
@errorlenshq/node reports uncaught exceptions and unhandled promise rejections, isolates context per request in any HTTP server, and traces outgoing calls — with no dependencies.
Install and initialize
Node.js 18 or newer. Initialize before anything else in your entry file. ES modules and CommonJS both work.
npm install @errorlenshq/nodeimport * as ErrorLens from "@errorlenshq/node";
ErrorLens.init({
dsn: process.env.ERRORLENS_DSN,
tracesSampleRate: 0.2,
enableLogs: true,
});Automatic, for any Node.js server
- Uncaught exceptions and unhandled rejections — reported, then the process exits exactly as Node.js would
- Every incoming request gets its own scope (AsyncLocalStorage): users and breadcrumbs never mix between requests
- Transactions named after the route, continuing incoming W3C
traceparentheaders - Outgoing
http,httpsandfetchcalls traced and propagated - Console output as breadcrumbs, source context for your own frames, secrets scrubbed
- Express, Fastify, Koa and Hapi helpers for one-line error reporting
Serverless and scripts
// AWS Lambda, Google Cloud Functions…
export const handler = ErrorLens.wrapHandler(async (event) => {
// events are sent before the function returns
});
// short scripts
await ErrorLens.flush();Frequently asked questions
Will it change how my process crashes?
No. After reporting an uncaught error the SDK flushes and exits with code 1, as Node.js does by default, and it respects --unhandled-rejections=warn or none.
Does it support TypeScript?
Yes. Types are included, and the package ships both ES module and CommonJS builds.
How big is the SDK?
It has no third-party dependencies; the Node.js package and its core are about 35 KB packed.
Keep reading
Express error tracking in one line
Report Express errors with route-named transactions, request context and traces. Works with Express 4 and 5 in one line. Open-source error monitoring.
Next.js error tracking on the server and in the browser
Track Next.js errors on the server and in the browser: route handlers, server components and client errors in one trace. Setup with instrumentation.ts.
Open-source APM that links slow requests to their errors and logs
Open-source application performance monitoring: p50/p95 latency, throughput, failure rate and distributed traces linked to errors and logs. Self-host free.
Open-source log management linked to your errors and traces
Open-source log management: structured logs from your SDK or OpenTelemetry with search, severity filters, live tail and links to traces. Self-host on Postgres.
Start tracking errors in minutes
Free hosted plan with 5,000 errors a month, or self-host with no limits. No credit card.