Repository navigation
fix(observability): make Sentry route errors, releases and environments usable - #76
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
@coderabbitai full review |
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Free Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (10)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe change sanitizes route errors before Sentry capture. It also configures Sentry release and environment metadata, and conditionally enables source-map generation and upload during Vite builds. ChangesSentry observability
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant RouteErrorBoundary
participant toTelemetrySafeError
participant Sentry
RouteErrorBoundary->>toTelemetrySafeError: Caught error and route failure message
toTelemetrySafeError-->>RouteErrorBoundary: Sanitized error and filtered frames
RouteErrorBoundary->>Sentry: Capture sanitized error
Architecture SummaryArchitecture risk: 🔵 Low · up to The change affects 4 systems. Changed systems: Architecture concerns Review detailsSystems and components
Before / after behavior
Note 🎁 Summarized by CodeRabbit FreeYour organization is on the Free plan. CodeRabbit will generate a high-level summary and a walkthrough for each pull request. For a comprehensive line-by-line review, please upgrade your subscription to CodeRabbit Essentials by visiting https://app.coderabbit.ai/settings/billing. Comment |
…ts usable Route crashes were all reported as one synthetic error with the boundary's stack, so Sentry grouped every crash into a single issue. They now keep the original error type and code-location frames while the message, which can carry user text, is still replaced. Sentry events now carry the commit SHA as release and VERCEL_ENV as environment, so release health works and previews stop reporting as production. Hidden source maps are uploaded and deleted when SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT are set. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
|
Local verification on rebased head ba0c9b4 (GitHub Actions jobs are not starting because of an account billing/spending-limit block): npm ci, lint, typecheck, 1100 unit tests with coverage, docs:check, build, and Playwright desktop+mobile Chromium (226 passed, 6 skipped) all pass. |
498d24a to
ba0c9b4
Compare
|
@coderabbitai full review |
✅ Action performedFull review finished. |
What was wrong
Checking the live site showed three problems in the Sentry setup:
new Error("Route rendering failed")with the error boundary's own stack. Sentry grouped all crashes into one issue that pointed at the wrong code.releasewas unset. Sentry discards sessions without a release, so release health was empty and errors couldn't be tied to a deploy. No source maps were uploaded either, so stack traces were minified.environmentwas Vite'sMODE, which isproductionfor every Vercel build, including previews.Changes
toTelemetrySafeErrorinsrc/lib/observability.tskeeps the original error name, if it looks like*Error, and its code-location stack frames. It still replaces the message. The privacy result is unchanged: the original message is cut from V8 stacks before filtering, and only lines pointing at a URL or absolute path survive.causeis dropped and no component stack is sent. The privacy policy already discloses stack traces to Sentry.vite.config.tsinjects the commit SHA andVERCEL_ENVat build time. The SHA comes fromVERCEL_GIT_COMMIT_SHA, thenGITHUB_SHA, thengit rev-parse HEAD. Both Vercel variables are available at build time according to Vercel's system environment variable docs.@sentry/vite-pluginruns only whenSENTRY_AUTH_TOKEN,SENTRY_ORGandSENTRY_PROJECTare all set. It builds hidden maps, uploads them and deletes them fromdist/. Without those variables the build is unchanged and emits no maps.Needs Adam
Source map upload stays off until these are added to the Vercel project for Production and Preview:
SENTRY_AUTH_TOKEN: a Sentry organization token with source map upload scope;SENTRY_ORGandSENTRY_PROJECT: the slugs.Not changed on purpose
PostHog keeps
persistence: "memory"and never callsidentify, so each page load is a new anonymous person. That makes retention and unique-user numbers meaningless. The privacy text in all three locales promises that persistent browser storage is disabled. Changing this means choosing between two approaches, and both are privacy and consent decisions:identifywith the Supabase user ID, which is a new identifier that would have to be disclosed.Verification
ExplodingRouteframe failed before the change and passes after it. There are also unit tests for V8 and Gecko stacks, multi-line messages, frame-shaped message lines, unsafe names and non-Error values.npm run lint,npm run typecheck,npm test -- --coverage(1086 tests) andnpm run buildpass.VERCEL_GIT_COMMIT_SHAandVERCEL_ENV=previewputrelease:"abc123deadbeef",environment:"preview"into theSentry.initcall, with no.mapfiles.sourceMappingURL.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Documentation