Adds @sentry/nextjs v10 with the Next.js 16 instrumentation pattern:
- instrumentation.ts — server + edge runtime init
- instrumentation-client.ts — browser init with Session Replay
(free tier, mask all text/inputs by
default since chat content is sensitive)
- app/global-error.tsx — catches root-layout crashes that escape
every other error boundary
- app/sentry-example-page — verification page; click both buttons
- next.config.ts — wrapped with withSentryConfig, source
maps upload to Sentry on every build,
client error events tunneled through
/monitoring to bypass ad-blockers
Runtime capture works as soon as NEXT_PUBLIC_SENTRY_DSN is in Coolify
env (already added). Full source-map de-minification of prod stack
traces requires SENTRY_AUTH_TOKEN in Coolify env — pending user.
Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
567 B
TypeScript
22 lines
567 B
TypeScript
/**
|
|
* Companion endpoint to /sentry-example-page. Throws on every call
|
|
* so the "Throw server error" button has something real to fail
|
|
* against. The thrown error propagates to instrumentation.ts'
|
|
* onRequestError hook and lands in Sentry as a server-side issue.
|
|
*/
|
|
|
|
export const dynamic = "force-dynamic";
|
|
|
|
class SentryExampleApiError extends Error {
|
|
constructor(message: string) {
|
|
super(message);
|
|
this.name = "SentryExampleApiError";
|
|
}
|
|
}
|
|
|
|
export function GET() {
|
|
throw new SentryExampleApiError(
|
|
"Sentry test (API route) — vibn-ai",
|
|
);
|
|
}
|