Documentation
Node.js
Same package as the browser. No window — pass an absolute endpoint and optional serverUrl. Requires Node.js 18.12+.
Initialize
import { init } from '@retrace-kit/sdk';
init({
apiKey: process.env.RETRACE_KIT_API_KEY ?? '',
endpoint: process.env.RETRACE_KIT_ENDPOINT ?? 'https://api.retracekit.cloud/api/error-events',
serverUrl: process.env.RETRACE_KIT_SERVER_URL,
environment: process.env.NODE_ENV,
release: process.env.RETRACE_KIT_RELEASE,
}); | Option | Default | Notes |
|---|---|---|
apiKey | - | Required. |
endpoint | https://api.retracekit.cloud/api/error-events | Must be absolute. Local: http://localhost:8080/api/error-events. |
serverUrl | - | Sent as url on every error. See below. |
release, environment | - | Attached to every error. |
Auto-capture
After init, the SDK listens for uncaughtException and
unhandledRejection.
Error
throw or rejection
Handler
process listener
Payload
stack, serverUrl, context
Dashboard
issue
Events include userAgent like Node.js/22.12.0, tag runtime:node, and
show under Affected sources. Handled errors:
captureException.
serverUrl
Node has no page URL. Set serverUrl in init to fill the url field:
init({
apiKey: process.env.RETRACE_KIT_API_KEY ?? '',
serverUrl: 'https://api.example.com',
}); Without it, errors still arrive — stack and message are enough — but the issue page has no URL.
Limitations
- fetch only — no XHR breadcrumbs; use
fetchor addBreadcrumb. - No automatic url — set
serverUrlor pass overrides tocaptureException. - Absolute endpoint — relative paths do not resolve without a browser origin.
Example: examples/node-basic in the repo.