Skip to content

fix(tracing): Detect expo/fetch behind the Expo Router fetch wrapper - #6965

Merged
antonis merged 4 commits into
mainfrom
antonis/expo-router-fetch-detection
Nov 4, 2026
Merged

antonis merged 4 commits into
mainfrom
antonis/expo-router-fetch-detection

Conversation

@antonis

@antonis antonis commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

isExpoFetchEnabled() checks for the expo.builtin marker on globalThis.fetch. In Expo Router apps, @expo/metro-runtime wraps fetch to support relative URLs, and before 58.0.15 the wrapper dropped that marker. The SDK then misses expo/fetch, so fetch tracing and fetch breadcrumbs stay off by default.

When the marker is missing, isExpoFetchEnabled() now also returns true if:

  • globalThis.fetch has the wrapper's own marker (expo.polyfillFetchWithWindowLocation),
  • the Expo SDK is 56 or later (the first SDK that installs expo/fetch), read from the native ExponentConstants.manifest (a JSON string on Android), and
  • the app hasn't opted out with EXPO_PUBLIC_USE_RN_FETCH. It's read the same way as Expo's own runtime, so both resolve the same value after babel-preset-expo.

If any of these can't be determined, it returns false, which is the previous behavior.

This also applies the expo/fetch HTTP timings default from #6912 to these apps, so traceFetch: true no longer needs enableHTTPTimings: false to avoid leaking listeners.

💡 Motivation and Context

Fixes #6874

💚 How did you test it?

  • Unit tests for isExpoFetchEnabled(): SDK 56/57/58, SDK 55, unknown SDK version, manifest as a JSON string and as invalid JSON, EXPO_PUBLIC_USE_RN_FETCH set to 1, true and 0.
  • Expo sample:
    • Before: a traced fetch produced no http.client span and no fetch breadcrumb.
    • After: one http.client span without HTTP timings, and a fetch breadcrumb.
    • With EXPO_PUBLIC_USE_RN_FETCH=1: one http.client span from XHR and only an xhr breadcrumb (no duplicate).

📝 Checklist

  • I added tests to verify changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • All tests passing.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.
  • No breaking changes.

🔮 Next steps

antonis and others added 2 commits October 29, 2026 13:38
@expo/metro-runtime before 58.0.15 wraps fetch in Expo Router apps and
drops the expo.builtin marker. Fall back to the wrapper's own marker on
Expo SDK 56+ unless the app opted out with EXPO_PUBLIC_USE_RN_FETCH.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Semver Impact of This PR

⚪ None (no version bump detected)

📋 Changelog Preview

This is how your changes will appear in the changelog.
Entries from this PR are highlighted with a left border (blockquote style).


  • fix(tracing): Detect expo/fetch behind the Expo Router fetch wrapper by antonis and claude in #6965
  • docs(core): Drop stale logger.warn note from AGENTS.md by antonis and claude in #6968
  • chore(deps): update JavaScript SDK to v10.78.0 by antonis and claude in #6973
  • chore(deps): Bump getsentry/craft from 2.35.0 to 3.5.0 by alwx in #6983
  • chore(deps): update Maestro to v2.12.1 by github-actions in #6981
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 3.0.0 to 3.4.1 by alwx with dependabot in #6979
  • chore(deps): bump node-forge from 1.4.0 to 1.4.2 by dependabot in #6982
  • chore(deps): bump getsentry/github-workflows/validate-pr from 36c729264d2edc29ebae61950c50e1e9f043ad7e to 01bcb7fe69bb48bacd83e675840e3dc95b33c730 by dependabot in #6978
  • chore(deps): bump ruby/setup-ruby from 1.334.0 to 1.336.0 by dependabot in #6977
  • chore(deps): bump gradle/actions/setup-gradle from 6.4.0 to 6.4.1 by dependabot in #6976
  • fix(ios): Honor Sentry.Mask in error screenshots by antonis and claude in #6974
  • fix(android): Restore enableLogs option mapping by antonis and claude in #6967
  • chore(deps): update Wizard to v9.1.0 by github-actions in #6972
  • chore(deps): update Sentry Android Gradle Plugin to v6.25.0 by github-actions in #6971

🤖 This preview updates automatically when you update the PR.

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Oct 29, 2026
@antonis
antonis marked this pull request as ready for review October 29, 2026 13:01
@antonis
antonis requested review from a team and lucas-zimerman as code owners October 29, 2026 13:01
@antonis
antonis requested review from alwx and buenaflor and removed request for a team October 29, 2026 13:01
@sentry

sentry Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
Sentry RN io.sentry.reactnative.sample 8.33.0 (113) Release

⚙️ sentry-react-native Build Distribution Settings

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a496d0f. Configure here.

@alwx alwx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me

@antonis
antonis merged commit 97511fe into main Nov 4, 2026
140 of 144 checks passed
@antonis
antonis deleted the antonis/expo-router-fetch-detection branch November 4, 2026 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-to-merge Triggers the full CI test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isExpoFetchEnabled() returns false in Expo Router apps because metro-runtime wraps global fetch

2 participants