You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
isExpoFetchEnabled() returns false in Expo Router apps because metro-runtime wraps global fetch #6874
isExpoFetchEnabled() (utils/environment.js, added in #6225) returns false in an Expo Router app even though expo/fetch is the active global fetch. As a result the SDK keeps fetch tracing and fetch breadcrumbs off, and requests made with fetch get no http.client span, no breadcrumb and no trace headers from the JS side.
Cause: the check looks for Symbol.for('expo.builtin') on globalThis.fetch. In an Expo Router app, @expo/metro-runtime replaces global.fetch with a wrapper (wrapFetchWithWindowLocation in src/location/install.native.ts, to support relative URLs). The wrapper is a new function, so it doesn't carry the expo.builtin marker. It does carry its own marker, Symbol.for('expo.polyfillFetchWithWindowLocation').
Steps to reproduce
Expo SDK 57 app using Expo Router, without EXPO_PUBLIC_USE_RN_FETCH.
Call isExpoFetchEnabled() after startup, or check globalThis.fetch[Symbol.for('expo.builtin')]: it's undefined.
Make a fetch request inside an active span: no http.client span or breadcrumb is created for it.
What we did
We worked around it in two steps: first we turned fetch tracing on manually (reactNativeTracingIntegration({ traceFetch: true })). Later we switched the app back to React Native's own fetch with EXPO_PUBLIC_USE_RN_FETCH=1, because the replay Network tab only records XHR requests, and in that mode the existing XHR instrumentation covers everything.
A fix could be for the detection to also recognise the metro-runtime wrapper, or for Expo to copy the expo.builtin marker onto its wrapper. Happy to file the second part with Expo if that's the better place.
Thanks for the detailed report and for tracking down the root cause, @tareksabry1337! 🙏
You're right. @expo/metro-runtime replaces global.fetch with a wrapper that drops the expo.builtin marker, so isExpoFetchEnabled() returns false in Expo Router apps on SDK 56+. Fetch tracing and fetch breadcrumbs then stay off by default.
On the workarounds:
Keep expo/fetch:traceFetch: true gives you spans and trace headers. Fetch breadcrumbs are controlled separately, so you'd also want Sentry.breadcrumbsIntegration({ fetch: true }). This doesn't create duplicates, because expo/fetch doesn't go through XHR.
EXPO_PUBLIC_USE_RN_FETCH=1: this is the more complete option today, since our XHR instrumentation then covers spans, breadcrumbs and the Replay Network tab. Make sure to remove any traceFetch: true or fetch: true overrides in this mode. React Native's fetch is built on XHR, so having both on would give you duplicate spans and breadcrumbs.
Next steps on our side:
We'll look into making the detection also recognize the metro-runtime wrapper, without misdetecting setups where the wrapper sits on top of React Native's fetch (SDK ≤55, or the EXPO_PUBLIC_USE_RN_FETCH opt-out).
We'd welcome you filing the Expo-side change (copying the expo.builtin marker onto the wrapper) if you're still up for it. That's the cleanest long-term fix. Please link it here.
The Replay Network tab only recording XHR requests is a separate limitation. We'll track it separately.
Expo SDK 56 and 57 pin @sentry/react-native ~7.11.0 (SDK 58 moves to ~8.28.0). 7.x has no expo/fetch detection, so apps on Expo's pinned version get no fetch spans or fetch breadcrumbs on iOS/Android, Router or not. A note on the automatic-instrumentation page would help.
For the detection work: the metro-runtime wrapper also hides whatwg-fetch's fetch.polyfill. Behind it, expo/fetch and RN's fetch look the same from JS, so EXPO_PUBLIC_USE_RN_FETCH is the only reliable signal until the wrapper keeps the marker.
With traceFetch: true: consider enableHTTPTimings: false. The per-span resource listener is removed only when a matching entry arrives, and expo/fetch doesn't appear to report any. Also, the span keeps the full URL, query included, in url/http.url, so scrubbing http.query alone doesn't remove it.
@tareksabry1337 I opened the Expo side: expo/expo#51545. It copies the marker only when the wrapped fetch has it, so RN's fetch is never misdetected.
FYI enableHTTPTimings: false doesn't actually work here (8.28.0 through 8.31.0). reactNativeTracingIntegration declares it (default) but never passes it to instrumentOutgoingRequests (here), so the browser default of true wins and every traced fetch adds a resource handler that only gets removed when a timing entry shows up (here). expo/fetch never sends one, so they pile up. 10 fetches, 10 handlers, option set or not.
Looks like setup just needs enableHTTPTimings: finalOptions.enableHTTPTimings.
Activity
linear-code commentedon Oct 12, 2026
RN-819
antonis commentedon Oct 12, 2026
Thank you for reporting. We will investigate this and iterate back 🙇
antonis commentedon Oct 13, 2026
Thanks for the detailed report and for tracking down the root cause, @tareksabry1337! 🙏
You're right.
@expo/metro-runtimereplacesglobal.fetchwith a wrapper that drops theexpo.builtinmarker, soisExpoFetchEnabled()returnsfalsein Expo Router apps on SDK 56+. Fetch tracing and fetch breadcrumbs then stay off by default.On the workarounds:
expo/fetch:traceFetch: truegives you spans and trace headers. Fetch breadcrumbs are controlled separately, so you'd also wantSentry.breadcrumbsIntegration({ fetch: true }). This doesn't create duplicates, becauseexpo/fetchdoesn't go through XHR.EXPO_PUBLIC_USE_RN_FETCH=1: this is the more complete option today, since our XHR instrumentation then covers spans, breadcrumbs and the Replay Network tab. Make sure to remove anytraceFetch: trueorfetch: trueoverrides in this mode. React Native's fetch is built on XHR, so having both on would give you duplicate spans and breadcrumbs.Next steps on our side:
EXPO_PUBLIC_USE_RN_FETCHopt-out).expo.builtinmarker onto the wrapper) if you're still up for it. That's the cleanest long-term fix. Please link it here.We'll update this issue as we make progress.
cwoolum commentedon Oct 14, 2026
A few things the thread doesn't cover yet:
@sentry/react-native ~7.11.0(SDK 58 moves to~8.28.0). 7.x has noexpo/fetchdetection, so apps on Expo's pinned version get no fetch spans or fetch breadcrumbs on iOS/Android, Router or not. A note on the automatic-instrumentation page would help.fetch.polyfill. Behind it,expo/fetchand RN's fetch look the same from JS, soEXPO_PUBLIC_USE_RN_FETCHis the only reliable signal until the wrapper keeps the marker.traceFetch: true: considerenableHTTPTimings: false. The per-spanresourcelistener is removed only when a matching entry arrives, andexpo/fetchdoesn't appear to report any. Also, the span keeps the full URL, query included, inurl/http.url, so scrubbinghttp.queryalone doesn't remove it.@tareksabry1337 I opened the Expo side: expo/expo#51545. It copies the marker only when the wrapped fetch has it, so RN's fetch is never misdetected.
antonis commentedon Oct 14, 2026
Thank you for iterating on this @cwoolum and the expo PR 🙇
dub578 commentedon Oct 17, 2026
FYI
enableHTTPTimings: falsedoesn't actually work here (8.28.0 through 8.31.0).reactNativeTracingIntegrationdeclares it (default) but never passes it toinstrumentOutgoingRequests(here), so the browser default oftruewins and every traced fetch adds aresourcehandler that only gets removed when a timing entry shows up (here). expo/fetch never sends one, so they pile up. 10 fetches, 10 handlers, option set or not.Looks like
setupjust needsenableHTTPTimings: finalOptions.enableHTTPTimings.antonis commentedon Oct 19, 2026
Thank you @dub578 🙇
github-actions commentedon Nov 5, 2026
A PR closing this issue has just been released 🚀
This issue was referenced by PR #6965, which was included in the 8.34.0 release.