Integrations/Next.js

Set Up Bugsly for Next.js

Full-stack error tracking for Next.js with App Router support, server action monitoring, and automatic instrumentation for both client and server.

1. Install the SDK

npm install @bugsly/nextjs

2. Configure Bugsly

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

// instrumentation-client.ts (browser)
import * as Bugsly from "@bugsly/nextjs";

Bugsly.init({
  dsn: "https://your-dsn@bugsly.dev/1",
  tracesSampleRate: 1.0,
});
export const onRouterTransitionStart = Bugsly.captureRouterTransitionStart;

// instrumentation.ts (server and edge)
import * as Bugsly from "@bugsly/nextjs";

export function register() {
  Bugsly.init({
    dsn: "https://your-dsn@bugsly.dev/1",
    tracesSampleRate: 1.0,
  });
}
export const onRequestError = Bugsly.captureRequestError;

// next.config.js
const { withBugslyConfig } = require("@bugsly/nextjs");
module.exports = withBugslyConfig({ /* your config */ }, { silent: true });

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"}]}}'

Comparing options for the client side? See the best React error tracking tools in 2026.

What You Get with Next.js

  • App Router and Pages Router support
  • Server action and route handler errors reported through onRequestError
  • Server-side and client-side error tracking in one SDK
  • Source maps uploaded with sentry-cli are applied to stack traces
  • Edge runtime support
  • AI analysis for hydration mismatches and SSR errors

Frequently Asked Questions

Does Bugsly support the Next.js App Router?

Yes. @bugsly/nextjs re-exports the Sentry Next.js SDK, so the App Router is covered through the instrumentation.ts hooks shown above: server errors in Server Components, Route Handlers and Server Actions reach Bugsly through onRequestError, and browser errors through instrumentation-client.ts.

Is there a setup wizard for Next.js?

There is no Bugsly setup wizard. Install @bugsly/nextjs, add the three files shown above with your DSN, and trigger an error (for example a route handler that throws) to confirm it arrives.

Can I track API route errors in Next.js?

Yes. Errors thrown in App Router Route Handlers are reported through onRequestError with the request URL and method. We tested a Route Handler that throws on Next.js 15 with @bugsly/nextjs 1.0.0.

Start tracking errors in Next.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