fix(sentry): fail the build when the sourcemap upload fails #144
No reviewers
Labels
No labels
dependencies
major
security-pin
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
trails-cool/trails!144
Loading…
Reference in a new issue
No description provided.
Delete branch "fail-build-on-sentry-upload-error"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #5 — the follow-up that stops this class of silent rot.
Why the 401 hid for six weeks
sentry-vite-plugintreats release creation and sourcemap upload failures as recoverable. Inbuild-plugin-manager.js:With
throwByDefault === falseand noerrorHandler, it logsAn error occurred. Couldn't finish all operationsand the build succeeds. Every deploy stayed green while no sourcemap had ever reached Sentry. Production stack traces were unsymbolicated the whole time and nothing reported it — #5 was found only by reading a build log for an unrelated reason.The change
An
errorHandlerthat rethrows, in both apps:The plugin calls the handler and propagates anything it throws, so the swallowed error becomes a build failure.
Verification
Ran a real build with a deliberately invalid token:
On
mainthat identical error exits 0. That is the whole bug, and the whole fix.pnpm typecheck,pnpm lintandpnpm testpass. I did not runpnpm test:e2elocally — it needs the Docker stack and nothing here can reach it, since the plugin is disabled without a token. CI runs it.Blast radius
Only builds carrying a token are affected.
disable: !process.env.SENTRY_AUTH_TOKENalready turns the plugin off entirely without one, so local builds and CI are untouched and only CD can trip this.The trade-off
A Sentry outage now blocks a deploy. That is deliberate and worth stating plainly, because it is a real cost: a transient upstream failure can hold up a release that is otherwise fine.
I think it is the right call — a deploy we cannot debug is worse than a deploy that waits, and #5 is six weeks of evidence for what the other default costs. If a blocked deploy ever becomes the bigger problem, the narrower fix is to rethrow only when an env var like
SENTRY_UPLOAD_REQUIREDis set, and set it incd-apps.ymlalone. Say so and I will do it that way instead.🤖 Generated with Claude Code