Skip to content

Conversation

mydea
Copy link
Member

@mydea mydea commented Sep 16, 2025

This changes our fetch transport a bit, making use of async functions and slightly adjusting error handling:

  1. Technically there was a bug if fetch is not available, as we would keep increasing the pendingBodySize/pendingCount and never decrease it.
  2. We had some dedicated error messages for edge cases that are IMHO not necessary - we can safe a few bytes by just using default error messages there.
  3. No need to use sync promise here, all of this is async anyhow.

Extracted this out of #17641

@mydea mydea requested review from Lms24 and s1gr1d September 16, 2025 09:17
@mydea mydea self-assigned this Sep 16, 2025
...options.fetchOptions,
};

if (!nativeFetch) {
Copy link
Member Author

Choose a reason for hiding this comment

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

this lead to pendingXX not being cleaned up in this case.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch!

*/
export function makeFetchTransport(
options: BrowserTransportOptions,
nativeFetch: typeof WINDOW.fetch | undefined = getNativeImplementation('fetch'),
Copy link
Member Author

Choose a reason for hiding this comment

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

this type was not what we expected it to be, as nativeFetch was interpreted to be typeof fetch anyhow because the undefined just lead to it assuming the return type of getNativeImplementation('fetch'), which was also typeof fetch 😅

Copy link
Contributor

github-actions bot commented Sep 16, 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.17 kB -0.1% -22 B 🔽
@sentry/browser - with treeshaking flags 22.73 kB -0.09% -20 B 🔽
@sentry/browser (incl. Tracing) 40.17 kB -0.09% -34 B 🔽
@sentry/browser (incl. Tracing, Replay) 78.54 kB -0.03% -22 B 🔽
@sentry/browser (incl. Tracing, Replay) - with treeshaking flags 68.24 kB -0.07% -44 B 🔽
@sentry/browser (incl. Tracing, Replay with Canvas) 83.21 kB -0.04% -25 B 🔽
@sentry/browser (incl. Tracing, Replay, Feedback) 95.41 kB -0.05% -46 B 🔽
@sentry/browser (incl. Feedback) 40.88 kB -0.07% -26 B 🔽
@sentry/browser (incl. sendFeedback) 28.82 kB -0.07% -18 B 🔽
@sentry/browser (incl. FeedbackAsync) 33.76 kB -0.07% -23 B 🔽
@sentry/react 25.89 kB -0.11% -28 B 🔽
@sentry/react (incl. Tracing) 42.17 kB -0.06% -25 B 🔽
@sentry/vue 28.65 kB -0.09% -23 B 🔽
@sentry/vue (incl. Tracing) 41.99 kB -0.06% -23 B 🔽
@sentry/svelte 24.2 kB -0.08% -18 B 🔽
CDN Bundle 25.75 kB -0.11% -27 B 🔽
CDN Bundle (incl. Tracing) 40.06 kB -0.08% -29 B 🔽
CDN Bundle (incl. Tracing, Replay) 76.27 kB -0.04% -26 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) 81.78 kB -0.04% -29 B 🔽
CDN Bundle - uncompressed 75.19 kB -0.13% -93 B 🔽
CDN Bundle (incl. Tracing) - uncompressed 118.52 kB -0.08% -93 B 🔽
CDN Bundle (incl. Tracing, Replay) - uncompressed 233.62 kB -0.04% -87 B 🔽
CDN Bundle (incl. Tracing, Replay, Feedback) - uncompressed 246.38 kB -0.04% -87 B 🔽
@sentry/nextjs (client) 44.16 kB -0.07% -29 B 🔽
@sentry/sveltekit (client) 40.6 kB -0.07% -25 B 🔽
@sentry/node-core 49.87 kB - -
@sentry/node 151.15 kB - -
@sentry/node - without tracing 91.75 kB +0.01% +1 B 🔺
@sentry/aws-serverless 105.2 kB - -

View base workflow run

...options.fetchOptions,
};

if (!nativeFetch) {
Copy link
Member

Choose a reason for hiding this comment

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

Good catch!

@mydea mydea force-pushed the fn/transport-adjustments branch from 3996942 to dd26af9 Compare September 16, 2025 11:12
@mydea mydea merged commit 57b0656 into develop Sep 16, 2025
141 checks passed
@mydea mydea deleted the fn/transport-adjustments branch September 16, 2025 11:28
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.

2 participants