Next.js @sentry/nextjs on Epure (dual DSN verify)
@sentry/nextjs self-host
Pin @sentry/nextjs@7.120.0, set SENTRY_DSN and NEXT_PUBLIC_SENTRY_DSN to the same Epure project, zero sample rates, Verify client/server/edge.
On this pageShowHide
Point official @sentry/nextjs@7.120.0 at Epure with both SENTRY_DSN and NEXT_PUBLIC_SENTRY_DSN on the same project. Init client, server, and edge; leave traces, profiles, and replay sample rates at 0. Confirm with Verify: 202 Accepted plus an Issues row after the env chip matches.
You already ship a Next.js App Router app on official Sentry SDKs and want exception Issues on a two-container self-host (Rust binary + PostgreSQL 16) without running full Sentry self-host for replay and APM. This how-to is the Next.js path: dual DSN env, three inits, CORS, then Verify.
Unique wedge: Next.js docs require both DSN env vars for one Epure project; client bundles cannot read SENTRY_DSN. Bias disclosed: Epure first-party docs are the source of truth for Epure behavior.
Primary how-to: Next.js. Acceptance: Verify. Pin/init: Quickstart. Host: Installation. CORS: Configuration. Maps: Source maps. Sibling: Sentry SDK compatible, Sourcemaps self-hosted verify, Epure vs Sentry.
Install and pin
Install the documented line: npm install @sentry/nextjs@7.120.0. Pin 7.120.0 for the same line Epure docs exercise. Newer majors may work; on v8+ move client init to instrumentation-client.ts, set enableTracing: false when the option exists, keep sample rates at 0, and confirm with Verify.
Dual DSN env
Client bundles cannot read SENTRY_DSN. Set both env vars to the same Epure project DSN or hydration and client throws never leave the tab.
SENTRY_DSN
- Rule
- Server/edge; same project UUID as public
NEXT_PUBLIC_SENTRY_DSN
- Rule
- Client bundle; required for browser throws
Missing NEXT_PUBLIC_*
- Rule
- Client throws stay in the tab
| Dimension | Rule |
|---|---|
| SENTRY_DSN | Server/edge; same project UUID as public |
| NEXT_PUBLIC_SENTRY_DSN | Client bundle; required for browser throws |
| Missing NEXT_PUBLIC_* | Client throws stay in the tab |
Example shape: SENTRY_DSN=http://YOUR_PUBLIC_KEY@localhost:8080/YOUR_PROJECT_ID and the same value in NEXT_PUBLIC_SENTRY_DSN.
Three inits (7.x)
Sentry JS 7.x uses three config files at the app root. Call Sentry.init in each. Sample rates for traces, profiles, and replay stay at 0 because those item types are discarded on Epure ingest.
Client example (sentry.client.config.ts): dsn: process.env.NEXT_PUBLIC_SENTRY_DSN, environment: "local", release: "my-app@1.0.0", tracesSampleRate: 0, profilesSampleRate: 0, replaysSessionSampleRate: 0, replaysOnErrorSampleRate: 0. Mirror server and edge with the same project DSN. Wrap next.config with withSentryConfig when you upload maps for the same release string.
What is captured
Exceptions that reach the official Next.js handlers are captured. Transactions, replay, and profiles are discarded.
Client
- What lands
- Hydration mismatches, browser-only throws
Server
- What lands
- RSC, server actions, route handlers
Edge
- What lands
- Middleware and edge routes
| Dimension | What lands |
|---|---|
| Client | Hydration mismatches, browser-only throws |
| Server | RSC, server actions, route handlers |
| Edge | Middleware and edge routes |
Handled errors: Sentry.captureException(error) inside your catch, then rethrow if needed. App Router and Server Component errors land when they reach the official handlers; confirm with Verify. Do not invent handler internals beyond that docs wording.
Never-send table
When Next.js never sends, use the docs symptom table before changing host shape.
Client throws missing
- What to do
- Set NEXT_PUBLIC_SENTRY_DSN (same project as SENTRY_DSN)
Failed OPTIONS from browser
- What to do
- Add app origin to EPURE_CORS_ORIGINS; recreate epure
401 / 403
- What to do
- Recopy DSN; revoked keys fail closed
202, empty Issues
- What to do
- Match env filter to environment: "local"
| Dimension | What to do |
|---|---|
| Client throws missing | Set NEXT_PUBLIC_SENTRY_DSN (same project as SENTRY_DSN) |
| Failed OPTIONS from browser | Add app origin to EPURE_CORS_ORIGINS; recreate epure |
| 401 / 403 | Recopy DSN; revoked keys fail closed |
| 202, empty Issues | Match env filter to environment: "local" |
Verify path
Send Sentry.captureException(new Error("Epure verify test")). Expect 202 Accepted plus { "id": "<uuid>" }, then an unresolved Issues row. Open the project that owns the DSN and match the environment chip to Sentry.init. Optional: upload JS/TS .map files for the same release (Source maps, Sourcemaps self-hosted verify).
Who should use what
Use this guide for a full Next.js app on Epure with official @sentry/nextjs. Use Browser + Node guides when you have a separate Vite SPA plus Express API. Stay on Sentry Cloud if session replay or APM is the daily debug loop.
Use this guide if
- You run Next.js App Router and want client + server + edge exceptions on Epure.
- You need the dual DSN env rule (
SENTRY_DSN+NEXT_PUBLIC_SENTRY_DSN). - You will Confirm with Verify after zeroing sample rates.
Read something else if
- You need the multi-runtime DSN-swap scoreboard: Sentry SDK compatible.
- You only need maps upload verify: Sourcemaps self-hosted verify.
- Replay or APM is required daily: stay on Sentry Cloud (Epure vs Sentry).
Limitations
Epure is not 100% Sentry compatible. Session replay, APM tracing, and profiling are not Epure features. There is no @epure/* package. Demangle is JS/TS only. Stack is two Compose services: Rust binary + PostgreSQL 16 (postgres:16-alpine). Cloud is not live.
- Epure is not 100% Sentry compatible.
- Session replay, APM tracing, and profiling are not Epure features.
- No
@epure/*package; use official@sentry/nextjs@7.120.0. - Demangle is JS/TS
.maponly; no Symbolicator component. - Do not invent App Router / RSC stack internals beyond docs wording.
- Cloud is not live.
Deep links: Next.js | Verify | Quickstart | Installation | Configuration | Source maps.