Skip to content

Fix SENTRY-WIRE: install @sentry/nextjs with DSN-gated init#231

Open
bmoss2015 wants to merge 1 commit into
mainfrom
fix/sentry-error-monitoring
Open

Fix SENTRY-WIRE: install @sentry/nextjs with DSN-gated init#231
bmoss2015 wants to merge 1 commit into
mainfrom
fix/sentry-error-monitoring

Conversation

@bmoss2015

Copy link
Copy Markdown
Owner

Summary

  • Adds @sentry/nextjs v8.55
  • Creates client / server / edge Sentry configs, instrumentation.ts, and wraps next.config.ts with withSentryConfig
  • All init paths are gated on a DSN env var. No DSN = no-op (so missing env doesn't break local dev or branch builds)
  • Source-map upload only fires when SENTRY_AUTH_TOKEN + SENTRY_ORG + SENTRY_PROJECT are all set
  • Client tunnel route /monitoring so ad-blockers don't drop error events

Required Vercel env vars (Bree to add)

  • NEXT_PUBLIC_SENTRY_DSN (preview + production)
  • SENTRY_DSN (server scope, can be same value as the public one)
  • SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT (for source-map upload during build)

Once these are set on a fresh deploy, throwing a test error from any page sends it to the Sentry project.

Test plan

  • After Bree adds env vars, redeploy the branch preview
  • Visit /api/test-error or throw on a page, confirm event lands in Sentry
  • Verify portal still loads on a build with NO Sentry env vars (no-op path)
  • Confirm app.nextsurplus.com/monitoring proxies to Sentry's intake
  • Login: info@mossyland.com / Anderson1028!$

…erver, edge

- package.json: add @sentry/nextjs ^8.55.2
- instrumentation.ts: register() loads server or edge Sentry config
  based on NEXT_RUNTIME; re-exports captureRequestError as
  onRequestError per Next 16 hook contract
- sentry.client.config.ts / sentry.server.config.ts /
  sentry.edge.config.ts: init only when a DSN is present, so no DSN ->
  no-op (local dev, ad-hoc branches still build). 10% trace sampling,
  session replay on errors only (mask text + block media)
- next.config.ts: withSentryConfig wraps the export only when
  SENTRY_AUTH_TOKEN / SENTRY_ORG / SENTRY_PROJECT are all set; tunnel
  route /monitoring to dodge ad-blockers

Required Vercel env vars (Bree to add):
- NEXT_PUBLIC_SENTRY_DSN (preview + production)
- SENTRY_DSN (server, can equal the public one)
- SENTRY_AUTH_TOKEN, SENTRY_ORG, SENTRY_PROJECT (for source-map upload)
@supabase

supabase Bot commented Jun 26, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project rsdmyydyhqgkkvwlklif because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@vercel

vercel Bot commented Jun 26, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
moss-equity-portal Error Error Jun 26, 2026 9:08pm

Request Review

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