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 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
Fails
🚫 Pull request is not ready for merge, please add the "ready-to-merge" label to the pull request
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 <noreply@anthropic.com>
@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 <noreply@anthropic.com>
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support applicationKey / moduleMetadata in Metro config for thirdPartyErrorFilterIntegration

2 participants