Repository navigation
feat: report errors to Sentry from all three runtimes - #493
Merged
Merged
Conversation
Adds @sentry/vue for the browser, @sentry/node for the SSR webserver on Cloud Run, and @sentry/node for the Cloud Functions. Each reads its own DSN — the browser's is inlined at build time via build.defineEnv, the other two read process.env at runtime — so they can point at one Sentry project or three. Every piece is inert without a DSN: the client guards fold to constants and Rolldown drops @sentry/vue out of the bundle entirely, so a build with no Sentry env in scope ships what it shipped before. - SSR render failures are captured explicitly in the render middleware, which catches everything itself and never calls next(err), so an Express error handler would never see one. - Functions are instrumented by re-exporting onCall / onRequest / onDocumentWritten with the firebase-functions signatures plus a try/catch, leaving all 16 handlers untouched. HttpsErrors carrying caller-fault codes are deliberately not reported. - notifyError() reports next to the existing GA4 exception event, and updateCustomClaims() mirrors the Firebase user and roles onto the Sentry scope. - Tracing and Session Replay default to a sample rate of 0, at which they are not merely unsampled but never bundled. - Source maps upload only when SENTRY_AUTH_TOKEN + SENTRY_ORG + SENTRY_PROJECT are all set; the plugin deletes them from dist/ before the deploy, so they never reach visitors. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@sentry/vite-plugin throws by default when release creation or the sourcemap upload fails, which aborts `quasar build`. That put a Sentry outage, an expired auth token or a rate limit in the critical path of deploying the site itself — for the sake of stack traces being readable. An errorHandler downgrades it to a warning. Verified against a rejected token: both failures log and the build still succeeds, and the plugin deletes the generated maps either way, so nothing can leak. The merge workflow also sweeps any stray *.js.map before the asset shuffle. That normally removes nothing, but it makes "no source maps on the CDN" a property of the deploy rather than of one plugin's cleanup. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Wires Sentry into the browser app, the SSR webserver on Cloud Run, and the Cloud Functions. Full rationale is in the new Error reporting (Sentry) section of
CLAUDE.md.@sentry/vuesrc/boot/sentry.tsbuild.defineEnv@sentry/node(src-ssr/package.json)src-ssr/sentry.ts.apphosting/service.template.yaml@sentry/nodefunctions/src/sentry.tsfunctions/.env, appended by the deploy workflowNotable choices
@sentry/vueout of the bundle entirely — verified: with no DSN the built boot file is literally({ app, router }) => {}.src-ssr/middlewares/render.ts. That middleware catches everything itself and never callsnext(err), so an Express error handler would never see a failed render. Redirect and route-not-found rejections are filtered out as normal control flow.functions/src/sentry.tsre-exportsonCall/onRequest/onDocumentWrittenwith identical signatures plus a try/catch.HttpsErrors with caller-fault codes (permission-denied,invalid-argument, …) are deliberately not reported —checkRole()throws those at people who simply are not allowed to do the thing.functions/.envby the workflow rather than stored inside theFUNCTIONS_ENVsecret, so oneSENTRY_DSNsecret configures all three runtimes and rotating it does not mean hand-editing an opaque blob.Verification
yarn build(SSR) andyarn spa-buildgreen — which is the typecheck + lint gate. Built both with and without a DSN.cd functions && yarn build && yarn lintgreen.permission-deniedrethrows in ~1 ms without flushing, a generic error reports and rethrows.service.yamlparse as valid YAML with the variables set and unset; the generatedfunctions/.envparses withGMAIL_*intact.Config already applied to this repo
SENTRY_DSN; variablesSENTRY_ORG=cksc,SENTRY_PROJECT=legislation, and the three sample rates at0.SENTRY_AUTH_TOKEN(Sentry → Settings → Auth Tokens, scopeproject:releases). Until it exists, source maps are not uploaded and production stack traces stay minified.🤖 Generated with Claude Code