Skip to content

fix(sveltekit): Avoid capturing redirect() calls as errors in Cloudflare #16853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Jul 9, 2025

This PR builds on top of #16852 to avoid capturing errors too early and too generally via the initCloudflareSentryHandle request handler. Internally, this handler used a wrapper from @sentry/cloudflare to capture errors but prior to #16852 it captured everything that was thrown. This included thrown redirect() objects from SvelteKit which serve as control flow mechanisms but should not be captured as errors.

This PR opts out of capturing errors in the Cloudflare wrapper. Instead, we rely on our already existing error capturing mechanisms in SvelteKit, which already ignore redirect() and a few other error classes.

closes #16847

@Lms24 Lms24 changed the base branch from develop to lms/feat-cloudflare-wrapRequestHandler-captureErrors July 9, 2025 08:40
@Lms24 Lms24 self-assigned this Jul 9, 2025
@Lms24 Lms24 requested review from s1gr1d, a team and andreiborza and removed request for a team July 9, 2025 08:43
@Lms24 Lms24 changed the title fix(sveltekit): Avoid capturing redirect() calls as errors in CloudFlare fix(sveltekit): Avoid capturing redirect() calls as errors in Cloudflare Jul 9, 2025
@Lms24 Lms24 linked an issue Jul 9, 2025 that may be closed by this pull request
3 tasks
Base automatically changed from lms/feat-cloudflare-wrapRequestHandler-captureErrors to develop July 9, 2025 13:35
@Lms24 Lms24 force-pushed the lms/fix-sveltekit-cf-wrapReqHandler-dont-capture-errors branch from b9dd738 to 98d6df2 Compare July 9, 2025 13:37
@Lms24 Lms24 enabled auto-merge (squash) July 9, 2025 13:38
@Lms24 Lms24 merged commit 29bf0d2 into develop Jul 9, 2025
35 checks passed
@Lms24 Lms24 deleted the lms/fix-sveltekit-cf-wrapReqHandler-dont-capture-errors branch July 9, 2025 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Redirect' captured as exception with keys: location, status
3 participants