Description
Expo SDK 56 replaces globalThis.fetch with a native implementation (expo/fetch) that bypasses XMLHttpRequest entirely. The Sentry React Native SDK disables fetch tracing on native (traceFetch: false) because RN's default fetch is a whatwg-fetch polyfill over XHR — tracing both would cause duplicates. However, with expo/fetch active, XHR instrumentation no longer captures network requests, resulting in:
- Missing
http.client spans for all fetch requests
- Missing fetch breadcrumbs
- No
sentry-trace / baggage headers injected (broken distributed tracing)
Root Cause
reactNativeTracingIntegration defaults to traceFetch: false and traceXHR: true on native
breadcrumbsIntegration defaults to fetch: false on native
expo/fetch is a fully native Expo Module (ExpoFetchModule) that does not use XHR
- XHR instrumentation never fires for
expo/fetch requests
Affected Versions
- Expo SDK 56+ (where
expo/fetch is the default)
- All versions of
@sentry/react-native
Workaround
Users can manually enable fetch tracing and breadcrumbs:
Sentry.init({
integrations: [
Sentry.reactNativeTracingIntegration({ traceFetch: true }),
Sentry.breadcrumbsIntegration({ fetch: true }),
],
});
Alternatively, opt out of expo/fetch by setting EXPO_PUBLIC_USE_RN_FETCH=1 in the .env file.
Proposed Fix
Detect expo/fetch at runtime via the Symbol.for('expo.builtin') marker that Expo's installGlobal sets on replaced globals, and flip traceFetch and fetch breadcrumbs to true when detected.
References
Description
Expo SDK 56 replaces
globalThis.fetchwith a native implementation (expo/fetch) that bypassesXMLHttpRequestentirely. The Sentry React Native SDK disables fetch tracing on native (traceFetch: false) because RN's default fetch is awhatwg-fetchpolyfill over XHR — tracing both would cause duplicates. However, withexpo/fetchactive, XHR instrumentation no longer captures network requests, resulting in:http.clientspans for all fetch requestssentry-trace/baggageheaders injected (broken distributed tracing)Root Cause
reactNativeTracingIntegrationdefaults totraceFetch: falseandtraceXHR: trueon nativebreadcrumbsIntegrationdefaults tofetch: falseon nativeexpo/fetchis a fully native Expo Module (ExpoFetchModule) that does not use XHRexpo/fetchrequestsAffected Versions
expo/fetchis the default)@sentry/react-nativeWorkaround
Users can manually enable fetch tracing and breadcrumbs:
Alternatively, opt out of
expo/fetchby settingEXPO_PUBLIC_USE_RN_FETCH=1in the.envfile.Proposed Fix
Detect
expo/fetchat runtime via theSymbol.for('expo.builtin')marker that Expo'sinstallGlobalsets on replaced globals, and fliptraceFetchand fetch breadcrumbs totruewhen detected.References
expo/fetchsource:expo/src/winter/fetch/fetch.ts(native implementation viaExpoFetchModule)installGlobalsource:expo/src/winter/installGlobal.ts(setsSymbol.for('expo.builtin'))