fix: pass sentry_key when forwarding envelopes to GlitchTip #31

Merged
ronnyandre merged 1 commit from fix/glitchtip-sentry-key into main 2026-11-17 12:18:31 +01:00
Owner

Follow-up to #30. That PR was merged before this fix was pushed to its branch.

Problem

GlitchTip answered 403 "Denied" to every browser error forwarded by /api/glitchtip/envelope, so no browser errors reached GlitchTip. GlitchTip only accepts the project key in the query string (?sentry_key=…&sentry_version=7) and ignores the DSN in the envelope header, which is all the tunnel forwarded. Server-side reporting wasn't affected, because @sentry/node adds the key itself.

Checked against the live instance with a client_report envelope, which creates no issue: without the key it returns 403 {"detail": "Denied"}, and with it, 200.

Fix

parseDsn now builds envelopeUrl with sentry_key and sentry_version. Tests are updated.

Testing

  • pnpm test src/lib/glitchtip.test.ts, pnpm typecheck and pnpm lint pass.
  • After deploying, run setTimeout(() => { throw new Error('glitchtip test') }) in the console. POST /api/glitchtip/envelope should return 200, and the issue should show up in GlitchTip.

🤖 Generated with Claude Code

Follow-up to #30. That PR was merged before this fix was pushed to its branch. ## Problem GlitchTip answered **403 "Denied"** to every browser error forwarded by `/api/glitchtip/envelope`, so no browser errors reached GlitchTip. GlitchTip only accepts the project key in the query string (`?sentry_key=…&sentry_version=7`) and ignores the DSN in the envelope header, which is all the tunnel forwarded. Server-side reporting wasn't affected, because `@sentry/node` adds the key itself. Checked against the live instance with a `client_report` envelope, which creates no issue: without the key it returns 403 `{"detail": "Denied"}`, and with it, 200. ## Fix `parseDsn` now builds `envelopeUrl` with `sentry_key` and `sentry_version`. Tests are updated. ## Testing - `pnpm test src/lib/glitchtip.test.ts`, `pnpm typecheck` and `pnpm lint` pass. - After deploying, run `setTimeout(() => { throw new Error('glitchtip test') })` in the console. `POST /api/glitchtip/envelope` should return 200, and the issue should show up in GlitchTip. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
GlitchTip ignores the DSN in the envelope header and answers 403 "Denied"
unless the key is in the query string, so every browser event the tunnel
forwarded was rejected.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
ronnyandre/fliary!31
No description provided.