Integrations/Node.js

Set Up Bugsly for Node.js

Monitor errors and performance in any Node.js application with automatic async context tracking, unhandled rejection capture, and process-level monitoring.

1. Install the SDK

npm install @bugsly/node

2. Configure Bugsly

Add the following to your application entry point. Replace the DSN with your project DSN from the Bugsly dashboard.

import * as Bugsly from "@bugsly/node";

// Initialize before any other imports
Bugsly.init({
  dsn: "https://your-dsn@bugsly.dev/1",
  environment: "production",
  tracesSampleRate: 1.0,
});

// Uncaught exceptions and unhandled rejections are captured automatically.
// Capture handled errors manually:
Bugsly.captureException(new Error("Something broke"));

// Short-lived scripts: wait for the send before the process exits
await Bugsly.flush(2000);

// Add context to errors
Bugsly.setUser({ id: "user-123", email: "user@example.com" });
Bugsly.setTag("feature", "checkout");

3. Verify It Works

Trigger a test error in your application and check your Bugsly dashboard. The error should show up as an issue within a few seconds.

Want to check your DSN before touching any code? From a macOS, Linux or WSL terminal, this sends one real error without any SDK (replace your-dsn with the key from your DSN):

curl -sS -X POST "https://bugsly.dev/api/1/envelope/" \
  -H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=your-dsn" \
  --data-binary $'{}\n{"type":"event"}\n{"level":"error","platform":"other","exception":{"values":[{"type":"CurlTestError","value":"Hello from my terminal"}]}}'

Choosing between tools? Our Node.js error tracking comparison covers Bugsly, Sentry, Rollbar, Honeybadger and Airbrake.

What You Get with Node.js

  • Automatic capture of unhandled exceptions and rejections
  • Async context tracking across callbacks and promises
  • Performance monitoring with distributed tracing
  • AI-powered root cause analysis
  • Compatible with CommonJS and ESM

Frequently Asked Questions

Does Bugsly work with ES modules in Node.js?

Yes. @bugsly/node re-exports @sentry/node, which works in CommonJS and ES modules. In ESM apps, put Bugsly.init in its own file and load it first with node --import ./instrument.mjs app.mjs so that instrumentation is applied before your other modules load.

How does Bugsly handle unhandled promise rejections?

@sentry/node captures unhandled promise rejections by default, and Bugsly receives them like any other error. No additional configuration is needed.

Can I use Bugsly with Node.js clustering?

Yes. Initialize Bugsly in each worker process. Each worker reports independently.

Start tracking errors in Node.js for free

The free plan includes 100 issues per month, 7-day retention and 10 AI requests per month. Paid plans start at $19/mo.

Start Free