Skip to content

Conversation

@JPeer264
Copy link
Member

@JPeer264 JPeer264 commented Dec 10, 2025

(closes #18449)
(closes JS-1281)

Problem

As of now, the user has no chance to disallow the manipulation of fetch errors, as we overwrite the error. This can cause problems as seen in #18449.

Solution

This adds a new option for the SDK (please be very critical about that new option here, since fetch has no integration this has to be added as a init option). always is the default and acts the same as it is now, so it is acting as feature:

enhanceFetchErrorMessages: 'always' | 'report-only' | false`

To give the user full control of how the errors are done there are 3 settings:

always report-only false
manipulate the error message directly
send only the changed message to Sentry

Special attention to reviewers

When having report-only the generated logs locally differ from the ones in Sentry. I am not quite sure if that would cause any problems. This is the only question which I don't have the answer to yet

Alternative

In case the size increase is too much, we can also have a boolean that disables that (which is on by default)

@JPeer264 JPeer264 requested review from Lms24 and logaretm December 10, 2025 16:04
@linear
Copy link

linear bot commented Dec 10, 2025

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

size-limit report 📦

Path Size % Change Change
@sentry/browser 24.91 kB +0.34% +84 B 🔺
@sentry/browser - with treeshaking flags 23.42 kB +0.45% +103 B 🔺
@sentry/browser (incl. Tracing) 41.72 kB +0.31% +126 B 🔺
@sentry/browser (incl. Tracing, Profiling) 46.31 kB +0.25% +112 B 🔺
@sentry/browser (incl. Tracing, Replay) 80.31 kB +0.16% +127 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70 kB +0.13% +88 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 84.99 kB +0.15% +123 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 97.21 kB +0.12% +109 B 🔺
@sentry/browser (incl. Feedback) 41.63 kB +0.24% +97 B 🔺
@sentry/browser (incl. sendFeedback) 29.59 kB +0.29% +85 B 🔺
@sentry/browser (incl. FeedbackAsync) 34.61 kB +0.31% +105 B 🔺
@sentry/react 26.64 kB +0.37% +98 B 🔺
@sentry/react (incl. Tracing) 43.89 kB +0.22% +95 B 🔺
@sentry/vue 29.38 kB +0.34% +97 B 🔺
@sentry/vue (incl. Tracing) 43.51 kB +0.24% +100 B 🔺
@sentry/svelte 24.93 kB +0.38% +92 B 🔺
CDN Bundle 27.34 kB +0.32% +87 B 🔺
CDN Bundle (incl. Tracing) 42.34 kB +0.25% +103 B 🔺
CDN Bundle (incl. Tracing, Replay) 79.05 kB +0.13% +101 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 84.5 kB +0.1% +81 B 🔺
CDN Bundle - uncompressed 80.37 kB +0.39% +310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 125.72 kB +0.25% +310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 242.25 kB +0.13% +310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 255.02 kB +0.13% +310 B 🔺
@sentry/nextjs (client) 46.11 kB +0.22% +101 B 🔺
@sentry/sveltekit (client) 42.08 kB +0.27% +113 B 🔺
@sentry/node-core 51.66 kB +0.09% +44 B 🔺
@sentry/node 161.55 kB +0.04% +51 B 🔺
@sentry/node - without tracing 93.09 kB +0.05% +42 B 🔺
@sentry/aws-serverless 108.6 kB +0.04% +41 B 🔺

View base workflow run

@github-actions
Copy link
Contributor

github-actions bot commented Dec 10, 2025

node-overhead report 🧳

Note: This is a synthetic benchmark with a minimal express app and does not necessarily reflect the real-world performance impact in an application.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,398 - 8,944 +5%
GET With Sentry 1,717 18% 1,769 -3%
GET With Sentry (error only) 6,124 65% 6,134 -0%
POST Baseline 1,200 - 1,217 -1%
POST With Sentry 596 50% 587 +2%
POST With Sentry (error only) 1,065 89% 1,077 -1%
MYSQL Baseline 3,369 - 3,392 -1%
MYSQL With Sentry 491 15% 486 +1%
MYSQL With Sentry (error only) 2,730 81% 2,757 -1%

View base workflow run

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Sounds reasonable to me! Let's make sure to document the new option, thanks!

@Lms24
Copy link
Member

Lms24 commented Dec 17, 2025

(I was thinking for a moment if it makes sense for us to only add the option to the globalHandlersIntegration but that's very hard to discover for users and we have to pay the size hit either way. So I'm fine with adding the top-level option)

@JPeer264 JPeer264 force-pushed the jp/enhance-fetch-error-message branch from 0350acc to 308c1f2 Compare December 18, 2025 09:57
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.

Appending hostname to fetch error messages breaks is-network-error and p-retry packages

2 participants