Skip to main content
@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.
Set your surface public key (INTERFERE_PUBLIC_KEY, interfere_pub_<region>_…) from Surfaces so telemetry routes to your project. For readable stack traces you’ll also upload source maps with the CLI, which needs your Interfere API key (INTERFERE_API_KEY).

Prerequisites

  • A NestJS app
  • Node.js >= 20

Install

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 very first import in main.ts, ahead of everything else.
src/main.ts
3

Register the module

InterfereModule.forRoot() installs a global exception filter, so unhandled exceptions are captured automatically.
src/app.module.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 a postbuild step:
package.json
Without an uploaded release, the collector has nothing to attach your telemetry to. See the CLI page for CI setup and the INTERFERE_API_KEY.

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:

Environment variables