Set Up Bugsly for Express
Monitor Express.js applications with automatic request handling, middleware error capture, and route-level performance tracing.
1. Install the SDK
npm install @bugsly/node express2. Configure Bugsly
Add the following to your application entry point. Replace the DSN with your project DSN from the Bugsly dashboard.
const Bugsly = require("@bugsly/node");
// Initialize before requiring express, so it can be instrumented
Bugsly.init({
dsn: "https://your-dsn@bugsly.dev/1",
environment: "production",
tracesSampleRate: 1.0,
});
const express = require("express");
const app = express();
app.get("/", (req, res) => {
res.json({ status: "ok" });
});
// Register after all routes, before your own error handlers
Bugsly.setupExpressErrorHandler(app);
app.listen(3000);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"}]}}'Weighing other options? Compare the best Node.js error tracking tools for Express and NestJS.
What You Get with Express
- Automatic Express middleware and route instrumentation
- Request context attached to every error (URL, method, headers)
- Route-level performance tracing
- Middleware error chain capture
- Compatible with Express 4.x and 5.x
Frequently Asked Questions
How do I set up Bugsly error handling in Express?
Call Bugsly.init() before you require express, then call Bugsly.setupExpressErrorHandler(app) after all of your routes and before any other error-handling middleware. Errors thrown in routes are then reported with the request context.
Does Bugsly track Express route performance?
Yes, when tracesSampleRate is above 0 and Bugsly.init() runs before express is required: the SDK then creates performance spans for each request.
Can I use Bugsly with Express and TypeScript?
Yes. @bugsly/node re-exports @sentry/node, which ships its own TypeScript definitions.
Start tracking errors in Express 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