Skip to main content
@interfere/nest captures server errors and traces from your NestJS app.

Prerequisites

  • A NestJS app
  • Node.js >= 20

Install

Set your public key

Copy the public key from your surface into the server environment:
Use production for production deployments.

Setup

1

Start the SDK before Nest loads

Create instrument.ts and call init(). This file must run before any @nestjs/* import so the SDK can instrument the runtime.
src/instrument.ts
2

Import it first in your entry file

Make instrument the first import in your existing main.ts, ahead of Nest. Keep the rest of your bootstrap function as it is.
src/main.ts
3

Register the module

InterfereModule.forRoot() installs a global exception filter that captures server errors and uncaught throws. Client errors with 4xx status codes produce request spans without error events.
src/app.module.ts

Verify capture

After initialization, report a temporary error in a staging process:
Check the surface’s event chart for incoming traffic. Remove the test capture afterward.

Source maps and releases

Publish release metadata and source maps after compiling the app. Follow the release workflow for the API calls and upload order. Build and runtime must resolve the same release. Set INTERFERE_SOURCE_ID to the same commit SHA in both environments when the deployed app has no git checkout. Keep build credentials in CI and use the surface public key for runtime ingestion.

Configuration

Pass options to init(). Most apps only set serviceName.
string
default:"node-app"
The name your telemetry is grouped under. Give each process a distinct value (an API, a worker, a cron) when they share one public key.
string
Group related services under one product surface, for example checkout across an API and its workers.
string
Environment label such as production or staging. Falls back to INTERFERE_ENVIRONMENT, then VERCEL_ENV, then NODE_ENV.
boolean
default:"false"
Log lifecycle events to stdout. Also enabled by INTERFERE_DEBUG=1.
The SDK also installs handlers for uncaught exceptions and unhandled rejections by default. Pass captureUncaughtException: false or captureUnhandledRejection: false to use your own.

Report a handled error

Unhandled exceptions are captured by the module’s filter. To report an error you catch yourself, or to trace a specific operation, import from @interfere/nest: