Documentation

Node.js

Same package as the browser. No window — call init with your API key. Requires Node.js 18.12+.

Initialize

import { init } from '@retrace-kit/sdk';

init({
  apiKey: process.env.RETRACE_KIT_API_KEY ?? '',
});

apiKey is enough. Optional release should come from package.json — see SDK → Release.

Option Default Notes
apiKey - Required.
environment - Attached to every error (for example process.env.NODE_ENV).
enabled true false pauses sending.

Auto-capture

After init, the SDK listens for uncaughtException and unhandledRejection.

Events include userAgent like Node.js/22.12.0, tag runtime:node, and show under Affected sources. Handled errors: captureException.

Request URL

Node has no page URL. Pass url on captureException so the issue page has a route:

import { captureException } from '@retrace-kit/sdk';

captureException(err, {
  url: _req.url,
});

Without it, errors still arrive — stack and message are enough — but the issue page has no URL.

Limitations

  • fetch only — no XHR breadcrumbs; use fetch or addBreadcrumb.
  • No automatic url — pass url to captureException.

Example: examples/node-basic in the repo.