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,
});

// Errors are captured automatically, or manually:
Bugsly.captureException(new Error("Something broke"));

// 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. You should see the error appear within seconds, complete with stack trace, breadcrumbs, and AI-powered analysis.

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
  • Memory leak and event loop lag detection
  • 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 supports both CommonJS (require) and ES modules (import). For ESM, make sure to import and initialize Bugsly before any other imports using --import or --require flags.

How does Bugsly handle unhandled promise rejections?

Bugsly automatically hooks into process.on('unhandledRejection') and captures the rejection with full async stack trace context. No additional configuration is needed.

Can I use Bugsly with Node.js clustering?

Yes. Initialize Bugsly in each worker process. Each worker reports independently, and Bugsly groups related errors across workers automatically.

Start tracking errors in Node.js for free

Get AI-powered error analysis, session replay, and performance monitoring — included free on every plan.

Start Free