chore: Upload production source maps to Sentry - #15
Merged
Merged
Conversation
Production stacks arrived minified, so a RangeError reported from an injected third-party script was indistinguishable from our own code without manually diffing line numbers against the deployed bundle. Generate hidden source maps only when SENTRY_AUTH_TOKEN is present, upload them, then strip them from dist so they never reach GitHub Pages. Also tag events with own_code so injected-script noise stays separable. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUBfrDZLkPRPZQJxJWzeU4
Only the auth token needs to stay secret, and requiring all three environment variables meant the upload silently skipped in CI. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MUBfrDZLkPRPZQJxJWzeU4
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.
Why
A
RangeError: Maximum call stack size exceededcame in from production (issue 7738519042) with a fully minified stack — alternatingOk/Qkframes. Determining whether it was ours required diffing the reported line numbers against the deployed bundle by hand:/visual-timer/:226:382(Qk)index.htmlis 61 lines/visual-timer/:226:63(Ok)index-BJf-jupJ.jsis 214 lines/visual-timer/:190:70Every frame was attributed to the document URL, and
index.htmlcarries no inline script — so the recursion came from a script injected into the page (iOS Chrome extension / in-app injection) and was picked up by the globalonerrorhandler. That should have taken seconds to establish, not a manual bundle diff.What
@sentry/vite-plugin. Source maps are generated (hidden) only whenSENTRY_AUTH_TOKENis present, uploaded, then deleted fromdist— so they are never published to GitHub Pages and local builds skip them entirely.SENTRY_AUTH_TOKENto the build step; org and project are plain constants invite.config.ts.releaseonSentry.initso uploaded maps match incoming events.own_code, derived from whether any located frame belongs to our hashed bundle underassets/. Events with no located frames default totrueso nothing real is mislabelled.Verification
npm run buildpasses;distcontains no.mapfiles.npm test— 32/32 passing.main; the plugin is a no-op without the token, so a failure there cannot break the deploy.Note
Unrelated to this crash,
src/hooks/useTimer.ts:221callsstart(false)during render, which triggerssetStateand afetchin the render phase. Worth a separate fix.🤖 Generated with Claude Code
https://claude.ai/code/session_01MUBfrDZLkPRPZQJxJWzeU4