Skip to main content

What is the Steadwing Node SDK?

The Steadwing Node SDK auto-captures exceptions, error logs, and HTTP breadcrumbs from your Node.js applications and sends them to Steadwing for root cause analysis. Add two lines of code and Steadwing starts monitoring your application no manual instrumentation required.

Auto-Capture

Unhandled exceptions, rejections, and error logs captured automatically

HTTP Breadcrumbs

Outgoing HTTP/HTTPS requests recorded with method, URL, status, and duration

Express & Fastify

Route error capture with full request context

Data Scrubbing

Sensitive fields (passwords, tokens, API keys) redacted before sending

Installation

npm install @steadwing/node
Requires Node.js 18+. View on npm or browse the source on GitHub.

Quick Start

Get your API key from app.steadwing.com/organization, then initialize the SDK:
const steadwing = require("@steadwing/node");

steadwing.init({
    apiKey: "st_your_api_key"
});
That’s it. The SDK automatically:
  • Captures unhandled exceptions (uncaughtException)
  • Captures unhandled promise rejections (unhandledRejection)
  • Captures console.error(), winston, and pino error-level logs
  • Records outgoing HTTP/HTTPS requests as breadcrumbs
  • Sends heartbeats every 60 seconds

Configuration

steadwing.init({
    apiKey: "st_...",          // Required: your API key
    service: "my-service",    // Optional: defaults to "default"
    env: "PROD",              // Optional: defaults to "PROD"
    enabled: true,            // Optional: set false to disable
});
Only events sent with env="PROD" are considered for auto-monitoring. Events from other environments are received but will not trigger automated RCA.

Manual Capture

For cases where you want to explicitly report errors or messages:
const steadwing = require("@steadwing/node");

// Capture a specific exception
try {
    riskyOperation();
} catch (err) {
    steadwing.captureException(err);
}

What Gets Captured

Exceptions

DataDescription
Stack traceFull V8 stack trace with file, line, and column
Exception chainError.cause chain included
BreadcrumbsLast 100 events leading up to the error
Request contextMethod, path, headers (when using framework middleware)

Logs

  • console.error() sent as events
  • Winston error/crit/emerg-level logs sent as events
  • Pino error/fatal-level logs sent as events
  • All log levels recorded as breadcrumbs for context

HTTP Breadcrumbs

Every outgoing HTTP/HTTPS request is recorded with:
  • Method and URL
  • Response status code
  • Request duration
  • Rolling buffer of last 100 entries

Data Scrubbing

Sensitive data is automatically scrubbed before leaving your application. Keys matching the following patterns (case-insensitive) have their values replaced with [REDACTED]:
password, passwd, secret, api_key, apikey, token, auth,
authorization, cookie, csrf, session, credit_card, ssn

Framework Support

FrameworkWhat’s Captured
ExpressRoute errors with full request context (method, path, headers)
FastifyRoute errors with request context via onError hook
winstonError-level log capture (auto-detected)
pinoError-level log capture (auto-detected)

Express

Add the error handler as your last middleware:
const steadwing = require("@steadwing/node");
const express = require("express");

steadwing.init({ apiKey: "st_..." });

const app = express();

app.get("/", (req, res) => res.send("ok"));
app.get("/fail", (req, res, next) => next(new Error("DB timeout")));

// Add as the last middleware
app.use(steadwing.expressErrorHandler());

app.listen(3000);

Fastify

Register the plugin on your Fastify instance:
const steadwing = require("@steadwing/node");
const fastify = require("fastify");

steadwing.init({ apiKey: "st_..." });

const app = fastify();
app.register(steadwing.fastifyErrorHandler());

app.listen({ port: 3000 });
Winston and pino are captured automatically when installed, no extra code needed.

TypeScript

Full TypeScript support with exported types:
import { init, captureException, expressErrorHandler } from "@steadwing/node";
import type { SteadwingConfig } from "@steadwing/node";

const config: SteadwingConfig = {
    apiKey: "st_...",
    service: "my-service",
};

init(config);

FAQs

No. After calling steadwing.init(), the SDK hooks into Node’s exception handling, console, and HTTP modules automatically. For Express/Fastify request context, add one line of middleware.
Minimal. Events are batched and sent every 5 seconds in a non-blocking flush. Breadcrumbs are stored in a fixed-size buffer. Timers use unref() so the SDK never keeps your process alive.
Yes. Pass enabled: false to steadwing.init() and the SDK becomes a no-op, no patches are installed and no events are sent.
The SDK coexists with other error trackers. It listens on process.on('uncaughtException') and patches console.error without removing existing listeners or handlers.
Sensitive fields are scrubbed before transmission. Data is sent over HTTPS to Steadwing’s backend. See the Data Scrubbing section for details on what’s redacted.
Need help? Contact us at hello@steadwing.com