feat: report browser and server errors to GlitchTip #30
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/glitchtip"
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?
Adds GlitchTip (Sentry-protocol) error reporting for both the browser and the server. It does nothing unless
GLITCHTIP_DSNis set. The variable is read at runtime, so it can be set in Dokploy without a rebuild.What's included
src/start.tscapture errors from server functions and API routes, then re-throw them unchanged. Server-function errors are tagged with the function name and file.@sentry/nodeis imported dynamically inside.server()bodies, so it stays out of the client bundle (checked in.output/public).@sentry/browserloads after hydration through named re-exports insrc/lib/_sentry-browser.ts, so it's a 29 KB gzipped chunk rather than 147 KB with the whole namespace.RouteErrorPagereports errors caught by the router's error boundary./api/glitchtip/envelopeforwards only envelopes addressed to our own project, with a 512 KB cap, so it can't be used as an open relay. Because of the tunnel, the CSP doesn't change (connect-src 'self').isExpectedErrorfilters out redirects, not-found,Unauthorized/ForbiddenandCannot delete:. Only the user id is sent: no email, cookies, request headers or bodies.CLAUDE.md, and the new env vars added toREADME.md.Testing
pnpm typecheck,pnpm lintandpnpm buildpass.pnpm testpasses (253 tests, 27 of them new insrc/lib/glitchtip.test.ts). One full run had a single failure I couldn't identify, and it hasn't come back in three reruns.Unauthorizederror was filtered out.setTimeout(() => { throw new Error('glitchtip test') })in the DevTools console and confirm the event shows up in GlitchTip.Deploy
Set
GLITCHTIP_DSNin Dokploy.GLITCHTIP_ENVIRONMENTandGLITCHTIP_RELEASEare optional.Follow-ups
🤖 Generated with Claude Code