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 📦

⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Path Size % Change Change
@sentry/browser 25.05 kB +0.39% +95 B 🔺
@sentry/browser - with treeshaking flags 23.58 kB +0.49% +114 B 🔺
@sentry/browser (incl. Tracing) 41.8 kB +0.28% +116 B 🔺
@sentry/browser (incl. Tracing, Profiling) 46.38 kB +0.23% +104 B 🔺
@sentry/browser (incl. Tracing, Replay) 80.41 kB +0.12% +96 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 70.12 kB +0.16% +111 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 85.11 kB +0.13% +108 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 97.31 kB +0.11% +99 B 🔺
@sentry/browser (incl. Feedback) 41.77 kB +0.24% +100 B 🔺
@sentry/browser (incl. sendFeedback) 29.73 kB +0.32% +93 B 🔺
@sentry/browser (incl. FeedbackAsync) 34.73 kB +0.29% +97 B 🔺
@sentry/browser (incl. Metrics) 26.16 kB +0.42% +108 B 🔺
@sentry/browser (incl. Logs) 26.3 kB +0.38% +99 B 🔺
@sentry/browser (incl. Metrics & Logs) 26.96 kB +0.42% +111 B 🔺
@sentry/react 26.78 kB +0.41% +109 B 🔺
@sentry/react (incl. Tracing) 44.02 kB +0.21% +89 B 🔺
@sentry/vue 29.5 kB +0.32% +92 B 🔺
@sentry/vue (incl. Tracing) 43.6 kB +0.2% +83 B 🔺
@sentry/svelte 25.06 kB +0.37% +90 B 🔺
CDN Bundle 27.57 kB +0.34% +93 B 🔺
CDN Bundle (incl. Tracing) 42.56 kB +0.24% +101 B 🔺
CDN Bundle (incl. Tracing, Replay) 79.26 kB +0.12% +91 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 84.68 kB +0.11% +91 B 🔺
CDN Bundle - uncompressed 80.82 kB +0.39% +310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 126.2 kB +0.25% +310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 242.74 kB +0.13% +310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 255.53 kB +0.13% +310 B 🔺
@sentry/nextjs (client) 46.37 kB +0.18% +82 B 🔺
@sentry/sveltekit (client) 42.18 kB +0.25% +105 B 🔺
@sentry/node-core 51.85 kB +0.1% +48 B 🔺
@sentry/node 162.1 kB +0.03% +38 B 🔺
@sentry/node - without tracing 93.29 kB +0.04% +37 B 🔺
@sentry/aws-serverless 108.78 kB +0.04% +37 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.
⚠️ Warning: Base artifact is not the latest one, because the latest workflow run is not done yet. This may lead to incorrect results. Try to re-run all tests to get up to date results.

Scenario Requests/s % of Baseline Prev. Requests/s Change %
GET Baseline 9,559 - 9,240 +3%
GET With Sentry 1,771 19% 1,697 +4%
GET With Sentry (error only) 6,130 64% 5,973 +3%
POST Baseline 1,206 - 1,176 +3%
POST With Sentry 596 49% 581 +3%
POST With Sentry (error only) 1,057 88% 1,051 +1%
MYSQL Baseline 3,348 - 3,239 +3%
MYSQL With Sentry 588 18% 442 +33%
MYSQL With Sentry (error only) 2,720 81% 2,645 +3%

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
Comment on lines +118 to +119
const enhanceOption = client?.getOptions().enhanceFetchErrorMessages ?? 'always';
const shouldEnhance = enhanceOption !== false;

This comment was marked as outdated.

Copy link
Collaborator

@logaretm logaretm left a comment

Choose a reason for hiding this comment

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

Looks great!

@JPeer264 JPeer264 force-pushed the jp/enhance-fetch-error-message branch from 670b698 to c03b7aa Compare January 9, 2026 07:26
@JPeer264 JPeer264 force-pushed the jp/enhance-fetch-error-message branch from c03b7aa to e569d60 Compare January 12, 2026 10:05
@JPeer264 JPeer264 force-pushed the jp/enhance-fetch-error-message branch from e569d60 to 1a07ef6 Compare January 12, 2026 10:15
@JPeer264 JPeer264 merged commit 090d08c into develop Jan 12, 2026
209 checks passed
@JPeer264 JPeer264 deleted the jp/enhance-fetch-error-message branch January 12, 2026 14:11
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

4 participants