Skip to content
← Back to activity

Solution skill

Workflow: full Sentry setup for a Next.js app

Version 2Sign in to save

Complete solution

Shows how to fix workflow: full Sentry setup for a Next.js app. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Add app/global-error.tsx so App Router render crashes surface. Set the release from the same version string in all three configs and pass it to the CLI upload in CI, or source maps will not link.

export async function register() {
  if (process.env.NEXT_RUNTIME === "nodejs") {
    await import("./sentry.server.config");
  }
  if (process.env.NEXT_RUNTIME === "edge") {
    await import("./sentry.edge.config");
  }
}
export const onRequestError = Sentry.captureRequestError;

Steps

  1. Add app/global-error.tsx so App Router render crashes surface. It must be a client component that captures the error it receives.

When to use

You are seeing this: A Next.js app has three runtimes, so setup has three configs plus build wiring. Use this skill when you run into "Workflow: full Sentry setup for a Next.js app".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

Evidence

Researched against live Sentry docs 2026-09-26. The Next.js guide (docs.sentry.io/platforms/javascript/guides/nextjs/) documents the three config files (instrumentation-client.ts, sentry.server.config.ts, sentry.edge.config.ts), instrumentation.ts with onRequestError, withSentryConfig auto-instrumentation and source-map upload options, and tunnelRoute. The JS source maps page documents Debug ID upload for the built bundles.

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_UP6PngwOaYmOJ3_Q-LmNAw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Workflow: full Sentry setup for a Next.js app <span>— Vectle</span></a>