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 24.89 kB +0.35% +86 B 🔺
@sentry/browser - with treeshaking flags 23.4 kB +0.43% +99 B 🔺
@sentry/browser (incl. Tracing) 41.67 kB +0.31% +127 B 🔺
@sentry/browser (incl. Tracing, Profiling) 46.25 kB +0.24% +110 B 🔺
@sentry/browser (incl. Tracing, Replay) 80.1 kB +0.17% +132 B 🔺
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 69.79 kB +0.13% +90 B 🔺
@sentry/browser (incl. Tracing, Replay with Canvas) 84.78 kB +0.17% +139 B 🔺
@sentry/browser (incl. Tracing, Replay, Feedback) 96.99 kB +0.12% +107 B 🔺
@sentry/browser (incl. Feedback) 41.61 kB +0.24% +99 B 🔺
@sentry/browser (incl. sendFeedback) 29.58 kB +0.3% +86 B 🔺
@sentry/browser (incl. FeedbackAsync) 34.59 kB +0.31% +106 B 🔺
@sentry/react 26.62 kB +0.37% +98 B 🔺
@sentry/react (incl. Tracing) 43.85 kB +0.22% +94 B 🔺
@sentry/vue 29.36 kB +0.34% +97 B 🔺
@sentry/vue (incl. Tracing) 43.46 kB +0.24% +104 B 🔺
@sentry/svelte 24.91 kB +0.37% +91 B 🔺
CDN Bundle 27.33 kB +0.34% +91 B 🔺
CDN Bundle (incl. Tracing) 42.33 kB +0.25% +102 B 🔺
CDN Bundle (incl. Tracing, Replay) 78.85 kB +0.13% +102 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) 84.31 kB +0.13% +104 B 🔺
CDN Bundle - uncompressed 80.35 kB +0.39% +310 B 🔺
CDN Bundle (incl. Tracing) - uncompressed 125.7 kB +0.25% +310 B 🔺
CDN Bundle (incl. Tracing, Replay) - uncompressed 241.73 kB +0.13% +310 B 🔺
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 254.49 kB +0.13% +310 B 🔺
@sentry/nextjs (client) 46.07 kB +0.23% +102 B 🔺
@sentry/sveltekit (client) 42.03 kB +0.28% +114 B 🔺
@sentry/node-core 51.54 kB +0.08% +41 B 🔺
@sentry/node 160.35 kB +0.04% +50 B 🔺
@sentry/node - without tracing 92.99 kB +0.08% +72 B 🔺
@sentry/aws-serverless 108.48 kB +0.04% +42 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 8,391 - 8,936 -6%
GET With Sentry 1,636 19% 1,749 -6%
GET With Sentry (error only) 5,859 70% 6,262 -6%
POST Baseline 1,151 - 1,218 -6%
POST With Sentry 516 45% 609 -15%
POST With Sentry (error only) 983 85% 1,074 -8%
MYSQL Baseline 3,186 - 3,364 -5%
MYSQL With Sentry 396 12% 495 -20%
MYSQL With Sentry (error only) 2,605 82% 2,759 -6%

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!

import { envelopeRequestParser, waitForErrorRequest } from '../../../utils/helpers';

sentryTest(
'enhanceFetchErrorMessages: false: enhances error for Sentry while preserving original @firefox',
Copy link
Member

Choose a reason for hiding this comment

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

l: we're testing against all browsers here, right?

Suggested change
'enhanceFetchErrorMessages: false: enhances error for Sentry while preserving original @firefox',
'enhanceFetchErrorMessages: false: enhances error for Sentry while preserving original',

);

sentryTest(
'enhanceFetchErrorMessages: false: enhances subdomain errors @firefox',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'enhanceFetchErrorMessages: false: enhances subdomain errors @firefox',
'enhanceFetchErrorMessages: false: enhances subdomain errors',

);

sentryTest(
'enhanceFetchErrorMessages: false: includes port in hostname @firefox',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'enhanceFetchErrorMessages: false: includes port in hostname @firefox',
'enhanceFetchErrorMessages: false: includes port in hostname',

import { envelopeRequestParser, waitForErrorRequest } from '../../../utils/helpers';

sentryTest(
'enhanceFetchErrorMessages: report-only: enhances error for Sentry while preserving original @firefox',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'enhanceFetchErrorMessages: report-only: enhances error for Sentry while preserving original @firefox',
'enhanceFetchErrorMessages: report-only: enhances error for Sentry while preserving original',

);

sentryTest(
'enhanceFetchErrorMessages: report-only: enhances subdomain errors @firefox',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'enhanceFetchErrorMessages: report-only: enhances subdomain errors @firefox',
'enhanceFetchErrorMessages: report-only: enhances subdomain errors',

);

sentryTest(
'enhanceFetchErrorMessages: report-only: includes port in hostname @firefox',
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
'enhanceFetchErrorMessages: report-only: includes port in hostname @firefox',
'enhanceFetchErrorMessages: report-only: includes port in hostname',

@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)

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