feat(web): wire up Sentry Next.js SDK (@sentry/nextjs) - #417
Merged
Conversation
apps/worker already had error tracking via @ghost/core/sentry (@sentry/node); apps/web had none, since raw @sentry/node's auto-instrumentation can't be webpack-bundled by Next.js. @sentry/nextjs ships its own webpack/turbopack plugin for exactly this, so wire it in directly: instrumentation.ts + instrumentation-client.ts + sentry.server.config.ts + sentry.edge.config.ts cover all three Next.js runtimes, global-error.tsx catches root-layout/render errors, and next.config.ts wraps with withSentryConfig for source-map upload. Follows the same opt-in-via-env-var contract as the worker's wrapper: SENTRY_DSN/NEXT_PUBLIC_SENTRY_DSN absent means fully disabled, and SENTRY_AUTH_TOKEN absent just skips source-map upload rather than failing the build. Verified `next build` still compiles cleanly with the withSentryConfig wrap in place. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
mohabbis
marked this pull request as ready for review
August 8, 2026 00:04
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apps/workeralready had error tracking via@ghost/core/sentry(@sentry/node);apps/webhad none, since raw@sentry/node's auto-instrumentation can't be webpack-bundled by Next.js (tried before, brokepnpm build).@sentry/nextjsships its own webpack/turbopack plugin for exactly this, so wire it in directly.instrumentation.ts,instrumentation-client.ts,sentry.server.config.ts,sentry.edge.config.ts(all three Next.js runtimes),src/app/global-error.tsx(App Router root error boundary), and wrapsnext.config.tswithwithSentryConfigfor source-map upload.SENTRY_DSN/NEXT_PUBLIC_SENTRY_DSNabsent means fully disabled (no network calls);SENTRY_AUTH_TOKENabsent just skips source-map upload rather than failing the build..env.exampleanddocs/DEPLOY.mdto document the new vars, and the comment inpackages/core/src/sentry.ts(previously said web wasn't wired — now it is).npx @sentry/wizard@latest -i nextjsfromcloud/apps/web, or create a project manually and setSENTRY_DSN/NEXT_PUBLIC_SENTRY_DSN.Test plan
pnpm typecheckpasses across all 4 packagesnext buildcompiles cleanly with thewithSentryConfigwrapsentry.test.ts(5 tests) still passes🤖 Generated with Claude Code