Skip to content

fix(core): Exclude additional server-only modules from native bundles#6263

Merged
antonis merged 5 commits into
mainfrom
fix/exclude-server-only-modules-from-native-bundle
Jun 9, 2026
Merged

fix(core): Exclude additional server-only modules from native bundles#6263
antonis merged 5 commits into
mainfrom
fix/exclude-server-only-modules-from-native-bundle

Conversation

@antonis

@antonis antonis commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Expands the Metro resolver's SERVER_ONLY_MODULE_RE regex to exclude additional server-only modules from Android/iOS bundles:

  • integrations/express
  • integrations/postgresjs
  • integrations/requestdata
  • integrations/consola
  • integrations/spanStreaming

Also fixes the regex terminator from (\/|$) to (\/|\.js|$) so it correctly matches single-file modules like postgresjs.js (not just directory-style paths like mcp-server/).

💡 Motivation and Context

Related: #6262

💚 How did you test it?

  • Added test cases for all 5 new modules (20 new tests) — all pass
  • Verified via source map analysis that all listed modules are excluded from the Android bundle
  • Confirmed bundle size reduction from 5.09 MB → 4.31 MB in the sample app

📝 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
  • No breaking changes

🔮 Next steps

Expand the Metro resolver's server-only module exclusion regex to cover
express, postgresjs, requestdata, consola, and spanStreaming integrations.
Also fix the regex terminator to match single-file modules (`.js` suffix).

Closes #6262

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

github-actions Bot commented Jun 8, 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(core): Exclude additional server-only modules from native bundles by antonis in #6263
  • Turbo Modules crash time context by alwx in #6227
  • fix: resolve sentry-cli relative to react-native package by shawnthye-guru in #6242
  • chore(deps): bump getsentry/craft from 2.26.6 to 2.26.8 by dependabot in #6260
  • chore(deps): bump getsentry/craft/.github/workflows/changelog-preview.yml from 2.26.6 to 2.26.8 by dependabot in #6259
  • chore(deps): bump actions/checkout from 6.0.2 to 6.0.3 by dependabot in #6257
  • chore(deps): bump github/codeql-action from 4.36.0 to 4.36.2 by dependabot in #6258
  • chore(deps): update Cocoa SDK to v9.16.1 by github-actions in #6252
  • chore(deps): update Android SDK to v8.43.1 by github-actions in #6253
  • chore(deps): update Sentry Android Gradle Plugin to v6.10.0 by github-actions in #6255
  • feat(tracing): Wrap Expo Router push, replace, navigate, back, dismiss in addition to prefetch by alwx in #6221
  • chore(deps): bump jwt in /samples/react-native by antonis in #6251
  • feat(profiling): Add measurements to Android profiling by antonis in #6250
  • chore(deps): update CLI to v3.5.0 by github-actions in #6248
  • chore(deps): bump jwt from 2.9.3 to 2.10.3 in /samples/react-native-macos by dependabot in #6247
  • chore(deps): bump jwt from 2.10.2 to 2.10.3 in /performance-tests by dependabot in #6246
  • feat(android): Warn when Gradle resolves unsupported sentry-android version by antonis in #6238
  • chore(deps): update JavaScript SDK to v10.56.0 by github-actions in #6249
  • chore(ci): Pin all GitHub Actions to full commit SHAs by antonis in #6243
  • fix(tracing): Enable fetch instrumentation when expo/fetch is active by antonis in #6226
  • fix: Bump tmp to 0.2.7 to resolve path traversal vulnerability by antonis in #6233
  • feat(logs): Add enableAutoConsoleLogs option to opt out of console capture by alwx in #6235
  • chore(deps): update JavaScript SDK to v10.55.0 by github-actions in #6222
  • chore(deps): update Sentry Android Gradle Plugin to v6.9.0 by github-actions in #6230

Plus 1 more


🤖 This preview updates automatically when you update the PR.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 0f8183c. Configure here.

@antonis antonis added the ready-to-merge Triggers the full CI test suite label Jun 8, 2026
@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 571.60 ms 581.50 ms 9.90 ms
Size 48.30 MiB 53.56 MiB 5.25 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5569641+dirty 406.43 ms 428.51 ms 22.08 ms
ae37560+dirty 470.40 ms 564.12 ms 93.72 ms
2c735cc+dirty 414.09 ms 438.47 ms 24.38 ms
d2eadf8+dirty 414.64 ms 454.56 ms 39.92 ms
7ff4d0f+dirty 413.81 ms 450.64 ms 36.83 ms
a0d8cf8+dirty 411.71 ms 467.57 ms 55.87 ms
71abba0+dirty 496.54 ms 525.16 ms 28.63 ms
038a6d7+dirty 524.82 ms 531.92 ms 7.10 ms
0b5120f+dirty 503.22 ms 538.60 ms 35.38 ms
7d6fd3a+dirty 403.02 ms 422.56 ms 19.54 ms

App size

Revision Plain With Sentry Diff
5569641+dirty 48.30 MiB 53.48 MiB 5.18 MiB
ae37560+dirty 48.30 MiB 53.60 MiB 5.29 MiB
2c735cc+dirty 43.75 MiB 48.08 MiB 4.33 MiB
d2eadf8+dirty 48.30 MiB 53.48 MiB 5.18 MiB
7ff4d0f+dirty 48.30 MiB 53.60 MiB 5.30 MiB
a0d8cf8+dirty 48.30 MiB 53.49 MiB 5.19 MiB
71abba0+dirty 48.30 MiB 53.49 MiB 5.19 MiB
038a6d7+dirty 48.30 MiB 53.60 MiB 5.30 MiB
0b5120f+dirty 48.30 MiB 53.58 MiB 5.28 MiB
7d6fd3a+dirty 43.75 MiB 48.14 MiB 4.39 MiB

@sentry

sentry Bot commented Jun 8, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

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

⚙️ sentry-react-native Build Distribution Settings

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3859.40 ms 1209.26 ms -2650.14 ms
Size 5.15 MiB 6.68 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5c1e987+dirty 1204.30 ms 1222.15 ms 17.85 ms
3817909+dirty 1183.90 ms 1187.50 ms 3.60 ms
7d6fd3a+dirty 1223.29 ms 1229.57 ms 6.28 ms
5569641+dirty 3839.22 ms 1231.30 ms -2607.91 ms
0b5120f+dirty 3838.39 ms 1232.91 ms -2605.48 ms
7ac3378+dirty 1213.37 ms 1218.15 ms 4.78 ms
4b87b12+dirty 1212.90 ms 1222.09 ms 9.19 ms
890d145+dirty 1223.59 ms 1231.37 ms 7.78 ms
ef27341+dirty 3856.13 ms 1231.42 ms -2624.71 ms
ad66da3+dirty 3820.96 ms 1214.43 ms -2606.52 ms

App size

Revision Plain With Sentry Diff
5c1e987+dirty 3.38 MiB 4.73 MiB 1.35 MiB
3817909+dirty 3.38 MiB 4.73 MiB 1.35 MiB
7d6fd3a+dirty 3.38 MiB 4.77 MiB 1.39 MiB
5569641+dirty 5.15 MiB 6.67 MiB 1.51 MiB
0b5120f+dirty 5.15 MiB 6.68 MiB 1.53 MiB
7ac3378+dirty 3.38 MiB 4.76 MiB 1.38 MiB
4b87b12+dirty 3.38 MiB 4.77 MiB 1.39 MiB
890d145+dirty 3.38 MiB 4.77 MiB 1.38 MiB
ef27341+dirty 5.15 MiB 6.68 MiB 1.53 MiB
ad66da3+dirty 5.15 MiB 6.67 MiB 1.51 MiB

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3840.76 ms 1214.71 ms -2626.05 ms
Size 5.15 MiB 6.68 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5c1e987+dirty 1208.43 ms 1220.72 ms 12.29 ms
3817909+dirty 1210.76 ms 1215.64 ms 4.89 ms
7d6fd3a+dirty 1210.89 ms 1217.63 ms 6.74 ms
5569641+dirty 3824.35 ms 1210.78 ms -2613.57 ms
0b5120f+dirty 3843.24 ms 1223.00 ms -2620.24 ms
7ac3378+dirty 1202.35 ms 1198.31 ms -4.04 ms
4b87b12+dirty 1199.49 ms 1199.78 ms 0.29 ms
890d145+dirty 1212.98 ms 1220.10 ms 7.12 ms
ef27341+dirty 3835.20 ms 1212.23 ms -2622.97 ms
ad66da3+dirty 3855.02 ms 1213.43 ms -2641.59 ms

App size

Revision Plain With Sentry Diff
5c1e987+dirty 3.38 MiB 4.73 MiB 1.35 MiB
3817909+dirty 3.38 MiB 4.73 MiB 1.35 MiB
7d6fd3a+dirty 3.38 MiB 4.77 MiB 1.39 MiB
5569641+dirty 5.15 MiB 6.67 MiB 1.51 MiB
0b5120f+dirty 5.15 MiB 6.68 MiB 1.53 MiB
7ac3378+dirty 3.38 MiB 4.76 MiB 1.38 MiB
4b87b12+dirty 3.38 MiB 4.77 MiB 1.39 MiB
890d145+dirty 3.38 MiB 4.77 MiB 1.38 MiB
ef27341+dirty 5.15 MiB 6.68 MiB 1.53 MiB
ad66da3+dirty 5.15 MiB 6.67 MiB 1.51 MiB

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 433.90 ms 452.60 ms 18.70 ms
Size 48.30 MiB 53.56 MiB 5.25 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
8929511+dirty 469.49 ms 502.65 ms 33.16 ms
a736b76+dirty 405.78 ms 458.74 ms 52.96 ms
5c1e987+dirty 444.71 ms 475.13 ms 30.42 ms
5569641+dirty 465.92 ms 532.22 ms 66.30 ms
ae37560+dirty 428.96 ms 456.86 ms 27.90 ms
d2eadf8+dirty 468.02 ms 530.37 ms 62.35 ms
7ff4d0f+dirty 403.38 ms 427.06 ms 23.68 ms
a0d8cf8+dirty 533.71 ms 564.25 ms 30.54 ms
71abba0+dirty 411.04 ms 453.67 ms 42.63 ms
038a6d7+dirty 499.02 ms 527.68 ms 28.66 ms

App size

Revision Plain With Sentry Diff
8929511+dirty 43.94 MiB 49.02 MiB 5.08 MiB
a736b76+dirty 48.30 MiB 53.48 MiB 5.18 MiB
5c1e987+dirty 43.94 MiB 48.94 MiB 5.00 MiB
5569641+dirty 48.30 MiB 53.48 MiB 5.18 MiB
ae37560+dirty 48.30 MiB 53.60 MiB 5.29 MiB
d2eadf8+dirty 48.30 MiB 53.48 MiB 5.18 MiB
7ff4d0f+dirty 48.30 MiB 53.60 MiB 5.30 MiB
a0d8cf8+dirty 48.30 MiB 53.49 MiB 5.19 MiB
71abba0+dirty 48.30 MiB 53.49 MiB 5.19 MiB
038a6d7+dirty 48.30 MiB 53.60 MiB 5.30 MiB

@antonis antonis marked this pull request as ready for review June 8, 2026 11:36
@antonis antonis removed the ready-to-merge Triggers the full CI test suite label Jun 9, 2026
@github-actions

github-actions Bot commented Jun 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

Generated by 🚫 dangerJS against 788a0c6

Comment thread CHANGELOG.md
- Exclude additional server-only modules (`express`, `postgresjs`, `requestdata`, `consola`, `spanStreaming`) from native bundles ([#6263](https://github.com/getsentry/sentry-react-native/pull/6263))
- Enable fetch instrumentation when Expo SDK 56's native `expo/fetch` is active ([#6226](https://github.com/getsentry/sentry-react-native/pull/6226))

### Fixes

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.

Removing the duplicate section from previous merge

@lucas-zimerman lucas-zimerman left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGMT!

@antonis antonis merged commit f170ec3 into main Jun 9, 2026
59 of 65 checks passed
@antonis antonis deleted the fix/exclude-server-only-modules-from-native-bundle branch June 9, 2026 12:59
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.

2 participants