Skip to content

feat(web): wire up Sentry Next.js SDK (@sentry/nextjs) - #417

Merged
mohabbis merged 1 commit into
masterfrom
worktree-sentry-nextjs
Aug 8, 2026
Merged

feat(web): wire up Sentry Next.js SDK (@sentry/nextjs)#417
mohabbis merged 1 commit into
masterfrom
worktree-sentry-nextjs

Conversation

@mohabbis

@mohabbis mohabbis commented Aug 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • 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 (tried before, broke pnpm build). @sentry/nextjs ships its own webpack/turbopack plugin for exactly this, so wire it in directly.
  • Adds 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 wraps next.config.ts with withSentryConfig for source-map upload.
  • Same opt-in-via-env-var contract as the worker's wrapper: SENTRY_DSN/NEXT_PUBLIC_SENTRY_DSN absent means fully disabled (no network calls); SENTRY_AUTH_TOKEN absent just skips source-map upload rather than failing the build.
  • Updated .env.example and docs/DEPLOY.md to document the new vars, and the comment in packages/core/src/sentry.ts (previously said web wasn't wired — now it is).
  • No real Sentry project/DSN provisioned in this PR (no Sentry MCP available, and the setup wizard needs an interactive browser login) — someone needs to either run npx @sentry/wizard@latest -i nextjs from cloud/apps/web, or create a project manually and set SENTRY_DSN/NEXT_PUBLIC_SENTRY_DSN.

Test plan

  • pnpm typecheck passes across all 4 packages
  • next build compiles cleanly with the withSentryConfig wrap
  • Existing worker sentry.test.ts (5 tests) still passes
  • Provision a real Sentry project and verify a test error lands (needs a Sentry account — not done here)

🤖 Generated with Claude Code

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>
@vercel

vercel Bot commented Aug 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ghost Ready Ready Preview Aug 8, 2026 12:01am

@mohabbis
mohabbis marked this pull request as ready for review August 8, 2026 00:04
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@mohabbis
mohabbis merged commit 0b0f271 into master Aug 8, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant