Repository navigation
fix(core): Fall back to Sentry Metro middleware for debug symbolication - #7031
Open
lucas-zimerman wants to merge 2 commits into
Open
lucas-zimerman wants to merge 2 commits into
lucas-zimerman wants to merge 2 commits into
Conversation
React Native is deprecating deep imports such as `react-native/Libraries/Core/Devtools/symbolicateStackTrace` (RN 0.88 already warns at runtime). Add a `/__sentry/symbolicate` route to the Sentry Metro middleware that forwards to Metro's own `/symbolicate` endpoint, and use it in `DebugSymbolicator` when RN's `symbolicateStackTrace` is unavailable or fails. Refs #4877 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
📲 Install BuildsAndroid
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Adds a Sentry-owned symbolication path so
DebugSymbolicatorno longer depends only on React Native's internalsymbolicateStackTrace./__sentry/symbolicateroute increateSentryMetroMiddleware. It rewrites the URL to Metro's own/symbolicate(keeping any query string) and hands the request to Metro's handler. The body isn't read by our middleware, so Metro parses it as usual.symbolicateStackTraceindebugsymbolicatorutils.tsstill tries React Native's version first. If it's missing or throws or rejects, it POSTs the stack to${devServer.url}__sentry/symbolicateusing the existing un-instrumented XHR (no breadcrumbs or spans). Failures reject intoDebugSymbolicator's existingcatch, so nothing reaches the app.SENTRY_SYMBOLICATE_REQUEST_PATHandMETRO_SYMBOLICATE_REQUEST_PATHadded tometro/constants.ts. The hard-coded__sentry/contextpath now uses its constant.No public API changes (API report unchanged).
💡 Motivation and Context
React Native is removing deep imports like
react-native/Libraries/Core/Devtools/*from its public API (RFC #894). RN 0.88 already warns at runtime:parseErrorStackalready has a Sentry-parser fallback (#5946). This adds the equivalent forsymbolicateStackTrace, the second item of #4877.Refs #4877
💚 How did you test it?
yarn test(SDK + tools), lint,circularDepCheck,build:sdkandapi-report:checkpass./symbolicateand/__sentry/symbolicate; the responses are byte-identical.symbolicateStackTracethrow and tapped "Capture exception". The SDK logged the fallback warning and the top frame came back assrc/Screens/ErrorsScreen.tsx:79:45Button.props.onPress, in-app, with the correctcontext_line. With the change reverted, the normal path still sends the event with no fallback warning.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
rnlibraries.tsstillrequiresreact-native/Libraries/Core/Devtools/{parseErrorStack,symbolicateStackTrace,getDevServer}. Once React Native stops resolving them, Metro could fail to bundle on the unresolvedrequire. A follow-up could make the Sentry parser and/__sentry/symbolicatethe defaults and drop those imports.getDevServer(used by both fallbacks),Libraries/Promise,Libraries/Utilities/PolyfillFunctionsandLibraries/NativeComponent/NativeComponentRegistryare also deep imports.