Skip to content

How-to · @faultatlas/node

Capture incidents from Node.js

Capture server exceptions and messages with bounded delivery retries.

The Node.js agent captures production server telemetry. It redacts envelopes before buffering and retries only retryable transport outcomes within a bounded budget.

Start server capture

Create one agent for the process and flush the current bounded batch explicitly. Use start() only when process-level handlers are wanted.

import { createNodeAgent } from "@faultatlas/node";

const agent = createNodeAgent({
  ingestUrl: "https://faultatlas.example/api/incidents",
  projectKey: "project_demo",
  ingestToken: "your_ingest_token_here",
});

agent.captureMessage("Worker started");
await agent.flush();

Runtime lifecycle

Create one agent per Node.js process. Start installs the configured process-level handlers; stop removes them. Use explicit capture calls at request or job boundaries when you already know the relevant safe context.

The buffer and offline queue are bounded. Redaction happens before either queue, and transport retries are limited to retryable outcomes.

Safe context and troubleshooting

Send stable technical fields such as release, environment, route template, or job name. Do not attach raw headers, cookies, request bodies, database rows, or complete URLs with query strings.

If delivery fails, verify the token scope, endpoint, project key, and network access. Flush in shutdown hooks with your own timeout; telemetry must never delay application shutdown indefinitely.

The package also exports fetch transport, event buffer, and in-memory offline queue contracts. Express and Fastify integrations use the package subpaths documented by their public exports. See protocol contracts for the envelope format.