@interfere/nest connects your NestJS backend to Interfere. Once it’s wired in, unhandled exceptions across your controllers and providers are captured with full server-side stack traces, and you get manual capture and tracing when you want them.
Prerequisites
- A NestJS app
- Node.js
>= 20
Install
Setup
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
Import it first in your entry file
Make
instrument the very first import in main.ts, ahead of everything else.src/main.ts
Throw an error from a route and it shows up in your workspace within seconds, already grouped and triaged.
Source maps and releases
A backend has no bundler plugin, so use the CLI to upload source maps and register each deploy as a release. Add apostbuild step:
package.json
INTERFERE_API_KEY.
Configuration
Pass options toinit(). Most apps only set serviceName.
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.
Group related services under one product surface, for example
checkout across an API and its workers.Environment label such as
production or staging. Falls back to INTERFERE_ENVIRONMENT, then VERCEL_ENV, then NODE_ENV.Log lifecycle events to stdout. Also enabled by
INTERFERE_DEBUG=1.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:
Environment variables
| Variable | Required | Description |
|---|---|---|
INTERFERE_PUBLIC_KEY | Yes | Your surface public key (interfere_pub_<region>_…). Routes telemetry to your project. |
INTERFERE_API_KEY | For releases | Used by the CLI to upload source maps (interfere_secret_<region>_…). A build-time secret; keep it in CI. |
INTERFERE_ENVIRONMENT | No | Environment label for releases. Falls back to VERCEL_ENV, then NODE_ENV. |
INTERFERE_DEBUG | No | Set to 1 for lifecycle logs while setting up. |