Skip to content
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

fix(sveltekit): Avoid capturing Http 4xx errors on the client #10571

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

Lms24
Copy link
Member

@Lms24 Lms24 commented Feb 8, 2024

This PR adds the Http 400 avoidance logic from our server-side load function instrumentation to the client-side wrapper. Didn't know that these errors were a thing on the client side but now that we know, we definitely don't want to capture them.

Also added tests

closes #10568

Copy link
Contributor

github-actions bot commented Feb 8, 2024

size-limit report 📦

Path Size
@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped) 78.34 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped) 69.55 KB (-0.02% 🔽)
@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped) 73.5 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped) 63.19 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - Webpack (gzipped) 33.54 KB (+0.05% 🔺)
@sentry/browser (incl. browserTracingIntegration) - Webpack (gzipped) 33.4 KB (+0.06% 🔺)
@sentry/browser (incl. Feedback) - Webpack (gzipped) 31.39 KB (+0.07% 🔺)
@sentry/browser (incl. sendFeedback) - Webpack (gzipped) 31.39 KB (+0.07% 🔺)
@sentry/browser - Webpack (gzipped) 22.65 KB (+0.07% 🔺)
@sentry/browser (incl. Tracing, Replay, Feedback) - ES6 CDN Bundle (gzipped) 76.37 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (gzipped) 67.9 KB (0%)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (gzipped) 33.67 KB (+0.03% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped) 24.74 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing, Replay) - ES6 CDN Bundle (minified & uncompressed) 214.09 KB (+0.01% 🔺)
@sentry/browser (incl. Tracing) - ES6 CDN Bundle (minified & uncompressed) 101.89 KB (+0.02% 🔺)
@sentry/browser - ES6 CDN Bundle (minified & uncompressed) 74.27 KB (+0.02% 🔺)
@sentry/browser (incl. Tracing) - ES5 CDN Bundle (gzipped) 36.82 KB (+0.06% 🔺)
@sentry/react (incl. Tracing, Replay) - Webpack (gzipped) 69.95 KB (+0.03% 🔺)
@sentry/react - Webpack (gzipped) 22.68 KB (+0.05% 🔺)
@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped) 87.55 KB (-0.01% 🔽)
@sentry/nextjs Client - Webpack (gzipped) 51.73 KB (+0.03% 🔺)
@sentry-internal/feedback - Webpack (gzipped) 17.23 KB (+0.08% 🔺)

// Neither 400 errors, given that they are not valuable.
if (
isRedirect(objectifiedErr) ||
(isHttpError(objectifiedErr) && objectifiedErr.status < 500 && objectifiedErr.status >= 400)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so, the issue linked complains about 403 errors being captured, it talks about ignoring all 4xx errors, but we only ignore 400 - is that correct/on purpose?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's on purpose in the sense that we have the same logic on the server side and generally, afaik, we never want to capture 4xx errors by default.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh wait, I got confused by the comment which says neither 400 errors and thought this was filtering only 400 itself, not 403. all good then!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahh sorry, that was my mistake. 4xx is definitely the better description

@Lms24 Lms24 changed the title fix(sveltekit): Avoid capturing Http 400 errors on the client fix(sveltekit): Avoid capturing Http 4xx errors on the client Feb 8, 2024
@Lms24 Lms24 merged commit bc81b1a into develop Feb 9, 2024
53 checks passed
@Lms24 Lms24 deleted the lms/fix-sveltekit-http-400-errors-client-load branch February 9, 2024 15:25
Lms24 added a commit that referenced this pull request Feb 12, 2024
Add the Http 400 avoidance logic from our server-side `load`
function instrumentation to the client-side wrapper. Didn't know that
these errors were a thing on the client side but now that we know, we
definitely don't want to capture them.

Co-authored-by: Francesco Novy <[email protected]>
Lms24 added a commit that referenced this pull request Feb 12, 2024
Add the Http 400 avoidance logic from our server-side `load`
function instrumentation to the client-side wrapper. Didn't know that
these errors were a thing on the client side but now that we know, we
definitely don't want to capture them.

Co-authored-by: Francesco Novy <[email protected]>
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.

SvelteKit 4XX errors thrown in load functions should not trigger captureException
2 participants