Server, edge, and client instrumentation wired up via SENTRY_DSN / NEXT_PUBLIC_SENTRY_DSN. Fully inert without a DSN configured (verified with a clean local build + full test suite) — safe to ship ahead of actually having a Sentry project. Source-map upload is opt-in via SENTRY_AUTH_TOKEN (kept out of the Docker build-arg chain since build args land in image layer history; only the public DSN is a build arg).
20 lines
420 B
TypeScript
20 lines
420 B
TypeScript
import * as Sentry from "@sentry/nextjs";
|
|
|
|
export async function register() {
|
|
if (process.env.NEXT_RUNTIME === "nodejs") {
|
|
Sentry.init({
|
|
dsn: process.env.SENTRY_DSN,
|
|
tracesSampleRate: 0.1,
|
|
});
|
|
}
|
|
|
|
if (process.env.NEXT_RUNTIME === "edge") {
|
|
Sentry.init({
|
|
dsn: process.env.SENTRY_DSN,
|
|
tracesSampleRate: 0.1,
|
|
});
|
|
}
|
|
}
|
|
|
|
export const onRequestError = Sentry.captureRequestError;
|