Skip to content

feat(core): Support applicationKey and moduleMetadata in Metro config - #6863

Open
alwx wants to merge 3 commits into
mainfrom
alwx/feature/6858
Open

alwx wants to merge 3 commits into
mainfrom
alwx/feature/6858

Conversation

@alwx

@alwx alwx commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

This PR adds the applicationKey and moduleMetadata options to withSentryConfig and getSentryExpoConfig. The SDK injects the same module metadata snippet as @sentry/bundler-plugins as a virtual premodule, also in development bundles and in each Expo chunk. The PR also exports thirdPartyErrorFilterIntegration from @sentry/react-native.

💡 Motivation and Context

Without module metadata, thirdPartyErrorFilterIntegration sees every frame as third-party code, so a drop-… behavior drops all events. Fixes #6858.

The snippet is a local copy, and a test pins it to generateModuleMetadataInjectorCode. Only the object form of moduleMetadata is supported, because Metro does not know the org, project, or release.

💚 How did you test it?

I added unit tests for the snippet, the metadata assembly, the serializer, the Expo plugin, and the Metro config options. All SDK and tool tests pass.

📝 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

Document the new options and the integration in the React Native docs.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 9, 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).


  • feat(core): Support applicationKey and moduleMetadata in Metro config by alwx in #6863
  • chore(deps): bump nx from 22.7.7 to 22.7.12 by dependabot in #6857
  • chore(deps): bump compression from 1.7.5 to 1.8.2 by dependabot in #6856
  • chore(deps): bump postcss-selector-parser from 7.1.4 to 7.1.6 by dependabot in #6855
  • chore(deps): bump source-map-js from 1.2.1 to 1.2.2 by dependabot in #6854
  • chore(deps): bump proxy-addr from 2.0.7 to 2.0.8 by dependabot in #6853
  • chore(deps): bump handlebars from 4.7.9 to 4.7.10 by dependabot in #6862
  • chore(deps): update Wizard to v8.0.1 by github-actions in #6852

🤖 This preview updates automatically when you update the PR.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 4e05634

Inject the module metadata of @sentry/bundler-plugins as a virtual
premodule, so thirdPartyErrorFilterIntegration can find the frames of
the application. Export thirdPartyErrorFilterIntegration.

Fixes #6858

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alwx
alwx force-pushed the alwx/feature/6858 branch from e1bd076 to e53db48 Compare October 9, 2026 09:36
Comment thread packages/core/src/js/tools/utils.ts Fixed
Comment thread packages/core/etc/sentry-react-native.api.md
Add a test that shows that thirdPartyErrorFilterIntegration applies the
injected module metadata on ReactNativeClient.

Co-Authored-By: Claude <[email protected]>
@alwx
alwx marked this pull request as ready for review October 9, 2026 13:13
@alwx
alwx requested review from a team, antonis and lucas-zimerman as code owners October 9, 2026 13:13

@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.

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4e05634. Configure here.

unstable_beforeAssetSerializationPlugins: [
...(options.unstable_beforeAssetSerializationPlugins || []),
...((options.injectReleaseForWeb ?? true) ? [unstableReleaseConstantsPlugin(projectRoot)] : []),
...(moduleMetadata ? [unstableBeforeAssetSerializationModuleMetadataPlugin(moduleMetadata)] : []),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Expo skips development metadata injection

Medium Severity

getSentryExpoConfig only registers unstableBeforeAssetSerializationModuleMetadataPlugin and never prepends the metadata module onto serializer preModules. Expo applies that plugin when exporting chunks, while expo start uses baseJSBundle with the incoming premodules and does not run those plugins. Development Expo bundles therefore never define _sentryModuleMetadata, so thirdPartyErrorFilterIntegration still treats every frame as third-party — the failure this change is meant to fix, including Expo web where browser-extension filtering is the documented use case. withSentryConfig already injects through createSentryMetroSerializer before the hot/dev early return; Expo has no equivalent wrapper.

Additional Locations (2)
Fix in Cursor Fix in Web

Triggered by project rule: PR Review Guidelines for Cursor Bot

Reviewed by Cursor Bugbot for commit 4e05634. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The Expo dev server also runs unstable_beforeAssetSerializationPlugins before baseJSBundle (see createDefaultExportCustomSerializer in @expo/metro-config), so Expo dev bundles get the metadata module.

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Oct 12, 2026

@antonis antonis 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.

LGTM once the CI is 🟢

@sentry

sentry Bot commented Oct 12, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-react-native Build Distribution Settings

@github-actions

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3867.04 ms 1235.88 ms -2631.16 ms
Size 5.15 MiB 6.95 MiB 1.80 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a5d243c+dirty 3842.35 ms 1214.29 ms -2628.06 ms
6a3eb4c+dirty 3854.77 ms 1230.91 ms -2623.86 ms
e763471+dirty 3841.16 ms 1218.06 ms -2623.09 ms
6acdf1d+dirty 3844.33 ms 1212.96 ms -2631.38 ms
d61b289+dirty 3874.56 ms 1236.61 ms -2637.94 ms
ab203f9+dirty 3848.07 ms 1219.71 ms -2628.35 ms
1a2e7e0+dirty 3842.49 ms 1220.04 ms -2622.45 ms
0307fa4+dirty 3829.83 ms 1212.15 ms -2617.68 ms
3a829f0+dirty 3839.76 ms 1214.69 ms -2625.06 ms
23598c3+dirty 1207.00 ms 1209.90 ms 2.90 ms

App size

Revision Plain With Sentry Diff
a5d243c+dirty 5.15 MiB 6.68 MiB 1.53 MiB
6a3eb4c+dirty 5.08 MiB 6.68 MiB 1.60 MiB
e763471+dirty 4.98 MiB 6.51 MiB 1.53 MiB
6acdf1d+dirty 4.98 MiB 6.51 MiB 1.53 MiB
d61b289+dirty 5.15 MiB 6.95 MiB 1.80 MiB
ab203f9+dirty 4.98 MiB 6.51 MiB 1.53 MiB
1a2e7e0+dirty 4.98 MiB 6.46 MiB 1.49 MiB
0307fa4+dirty 4.98 MiB 6.46 MiB 1.48 MiB
3a829f0+dirty 5.15 MiB 6.70 MiB 1.54 MiB
23598c3+dirty 3.38 MiB 4.80 MiB 1.42 MiB

@github-actions

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 559.89 ms 618.24 ms 58.35 ms
Size 50.56 MiB 56.62 MiB 6.06 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
0b1b5e3+dirty 416.42 ms 470.58 ms 54.16 ms
a858ac3+dirty 426.50 ms 484.82 ms 58.32 ms
1a2e7e0+dirty 416.61 ms 445.46 ms 28.85 ms
a216cb9+dirty 458.66 ms 531.47 ms 72.81 ms
88735e9+dirty 429.04 ms 484.17 ms 55.13 ms
20fbd51+dirty 487.89 ms 535.60 ms 47.71 ms
7a89652+dirty 537.76 ms 567.84 ms 30.08 ms
a0a3177+dirty 441.27 ms 499.86 ms 58.59 ms
3d536d1+dirty 524.34 ms 547.32 ms 22.98 ms
ed70c7f+dirty 452.43 ms 490.02 ms 37.59 ms

App size

Revision Plain With Sentry Diff
0b1b5e3+dirty 48.30 MiB 53.60 MiB 5.29 MiB
a858ac3+dirty 49.74 MiB 55.08 MiB 5.34 MiB
1a2e7e0+dirty 49.74 MiB 54.82 MiB 5.07 MiB
a216cb9+dirty 49.74 MiB 55.08 MiB 5.34 MiB
88735e9+dirty 49.74 MiB 54.82 MiB 5.07 MiB
20fbd51+dirty 49.74 MiB 54.81 MiB 5.07 MiB
7a89652+dirty 48.30 MiB 53.60 MiB 5.30 MiB
a0a3177+dirty 49.74 MiB 55.37 MiB 5.63 MiB
3d536d1+dirty 49.74 MiB 55.26 MiB 5.52 MiB
ed70c7f+dirty 50.56 MiB 56.62 MiB 6.06 MiB

@github-actions

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 449.46 ms 482.60 ms 33.14 ms
Size 50.56 MiB 56.62 MiB 6.06 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
bc8f61e+dirty 419.31 ms 453.39 ms 34.08 ms
0a9e622+dirty 425.22 ms 457.00 ms 31.78 ms
bf168a4+dirty 430.60 ms 459.31 ms 28.71 ms
4953e94+dirty 398.80 ms 431.81 ms 33.01 ms
68ae91b+dirty 515.04 ms 578.08 ms 63.04 ms
b9bebee+dirty 500.50 ms 536.42 ms 35.92 ms
3817909+dirty 357.52 ms 391.52 ms 34.00 ms
4e0ba9c+dirty 421.39 ms 455.80 ms 34.41 ms
635676f+dirty 420.43 ms 428.23 ms 7.80 ms
be120d6+dirty 514.67 ms 543.17 ms 28.49 ms

App size

Revision Plain With Sentry Diff
bc8f61e+dirty 49.74 MiB 55.09 MiB 5.35 MiB
0a9e622+dirty 49.74 MiB 55.09 MiB 5.34 MiB
bf168a4+dirty 49.74 MiB 55.09 MiB 5.35 MiB
4953e94+dirty 43.94 MiB 48.94 MiB 5.00 MiB
68ae91b+dirty 49.74 MiB 54.79 MiB 5.05 MiB
b9bebee+dirty 48.30 MiB 53.58 MiB 5.28 MiB
3817909+dirty 43.94 MiB 48.94 MiB 5.00 MiB
4e0ba9c+dirty 48.30 MiB 53.49 MiB 5.19 MiB
635676f+dirty 50.56 MiB 56.46 MiB 5.90 MiB
be120d6+dirty 49.74 MiB 55.36 MiB 5.62 MiB

@github-actions

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3867.83 ms 1236.56 ms -2631.27 ms
Size 5.15 MiB 6.95 MiB 1.80 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
b9bebee+dirty 3858.02 ms 1231.92 ms -2626.11 ms
d771cd5+dirty 3841.09 ms 1224.64 ms -2616.44 ms
21a1e70+dirty 3826.22 ms 1217.74 ms -2608.47 ms
a858ac3+dirty 3850.72 ms 1226.35 ms -2624.37 ms
41d6254+dirty 3849.78 ms 1233.91 ms -2615.86 ms
9ad4522+dirty 3862.28 ms 1226.27 ms -2636.01 ms
7d6fd3a+dirty 1210.89 ms 1217.63 ms 6.74 ms
d0e3b3e+dirty 3846.64 ms 1226.27 ms -2620.38 ms
d61b289+dirty 3851.37 ms 1229.59 ms -2621.78 ms
71abba0+dirty 3852.70 ms 1224.53 ms -2628.16 ms

App size

Revision Plain With Sentry Diff
b9bebee+dirty 5.15 MiB 6.68 MiB 1.53 MiB
d771cd5+dirty 4.98 MiB 6.55 MiB 1.57 MiB
21a1e70+dirty 4.98 MiB 6.46 MiB 1.49 MiB
a858ac3+dirty 4.98 MiB 6.51 MiB 1.53 MiB
41d6254+dirty 5.15 MiB 6.70 MiB 1.54 MiB
9ad4522+dirty 4.98 MiB 6.56 MiB 1.58 MiB
7d6fd3a+dirty 3.38 MiB 4.77 MiB 1.39 MiB
d0e3b3e+dirty 4.98 MiB 6.51 MiB 1.53 MiB
d61b289+dirty 5.15 MiB 6.95 MiB 1.80 MiB
71abba0+dirty 5.15 MiB 6.67 MiB 1.52 MiB

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.

Support applicationKey / moduleMetadata in Metro config for thirdPartyErrorFilterIntegration

3 participants