Skip to content

feat(core): Add disableAutoUpload option to Expo plugin#6195

Open
antonis wants to merge 5 commits into
mainfrom
feat/expo-disable-auto-upload
Open

feat(core): Add disableAutoUpload option to Expo plugin#6195
antonis wants to merge 5 commits into
mainfrom
feat/expo-disable-auto-upload

Conversation

@antonis
Copy link
Copy Markdown
Contributor

@antonis antonis commented May 21, 2026

📢 Type of change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring

📜 Description

Adds a disableAutoUpload option to the Expo plugin (withSentry) that disables source map and debug symbol uploads at build time.

withSentry(config, {
  organization: "my-org",
  project: "my-project",
  disableAutoUpload: true,
});

iOS: Injects export SENTRY_DISABLE_AUTO_UPLOAD=true into both Xcode build phase shell scripts ("Bundle React Native code and images" and "Upload Debug Symbols to Sentry"). This means the env var is baked into the Xcode project after expo prebuild, so builds from the Xcode GUI work without needing env var access.

Android: Overrides project.ext.shouldSentryAutoUploadGeneral to return false in build.gradle, bypassing the System.getenv check in sentry.gradle.

Both platforms handle re-prebuild (already configured projects) and are idempotent — running prebuild multiple times with the option enabled won't duplicate the injected code.

Note: This option permanently disables uploads for all builds from the generated native project. To re-enable uploads, remove the option and run npx expo prebuild --clean. For per-build control, users should use the SENTRY_DISABLE_AUTO_UPLOAD env var instead.

💡 Motivation and Context

Closes #3552

Expo managed workflow users building from the Xcode GUI after expo prebuild cannot easily set the SENTRY_DISABLE_AUTO_UPLOAD environment variable, which causes upload failure warnings during local development builds. While workarounds exist (CLI env var prefix, EAS build profiles), a first-class plugin option provides a better developer experience.

💚 How did you test it?

  • 11 new unit tests covering:
    • Bundle phase: fresh prebuild, re-prebuild, idempotency, disableAutoUpload: false no-op
    • Debug files phase: JSON-encoded scripts, raw string fallback, idempotency
    • Android: fresh prebuild, re-prebuild, idempotency
    • Newline correctness (real \n vs literal \\n after JSON round-trip)
  • All 56 expo plugin tests pass
  • Full test suite passes (296 tests)
  • Lint, circular dep check, and API report all pass

📝 Checklist

🔮 Next steps

Closes #3552

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

github-actions Bot commented May 21, 2026

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): Add disableAutoUpload option to Expo plugin by antonis in #6195

🤖 This preview updates automatically when you update the PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 21, 2026

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 fd2f50f

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@antonis
Copy link
Copy Markdown
Contributor Author

antonis commented May 21, 2026

@sentry review

Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 e359bd2. Configure here.

Comment thread packages/core/plugin/src/withSentryAndroid.ts
Comment thread packages/core/plugin/src/withSentryAndroid.ts
@antonis antonis added the ready-to-merge Triggers the full CI test suite label May 21, 2026
@antonis antonis marked this pull request as ready for review May 21, 2026 09:00
@github-actions
Copy link
Copy Markdown
Contributor

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 413.26 ms 468.20 ms 54.94 ms
Size 48.30 MiB 53.58 MiB 5.28 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
3d377b5+dirty 406.18 ms 453.52 ms 47.34 ms
44c8b3f+dirty 414.20 ms 457.28 ms 43.08 ms
3817909+dirty 406.67 ms 416.58 ms 9.91 ms
bc0d8cf+dirty 412.37 ms 466.26 ms 53.89 ms
7d6fd3a+dirty 403.02 ms 422.56 ms 19.54 ms
ad66da3+dirty 468.46 ms 533.56 ms 65.10 ms
5fe1c6c+dirty 401.62 ms 445.28 ms 43.66 ms
9210ae6+dirty 475.41 ms 525.24 ms 49.84 ms
df5d108+dirty 527.06 ms 603.58 ms 76.52 ms
5569641+dirty 406.43 ms 428.51 ms 22.08 ms

App size

Revision Plain With Sentry Diff
3d377b5+dirty 43.75 MiB 48.14 MiB 4.39 MiB
44c8b3f+dirty 48.30 MiB 53.46 MiB 5.15 MiB
3817909+dirty 43.75 MiB 48.08 MiB 4.33 MiB
bc0d8cf+dirty 48.30 MiB 53.48 MiB 5.18 MiB
7d6fd3a+dirty 43.75 MiB 48.14 MiB 4.39 MiB
ad66da3+dirty 48.30 MiB 53.49 MiB 5.19 MiB
5fe1c6c+dirty 43.75 MiB 48.14 MiB 4.39 MiB
9210ae6+dirty 48.30 MiB 53.54 MiB 5.23 MiB
df5d108+dirty 43.75 MiB 48.08 MiB 4.33 MiB
5569641+dirty 48.30 MiB 53.48 MiB 5.18 MiB

@sentry
Copy link
Copy Markdown

sentry Bot commented May 21, 2026

📲 Install Builds

Android

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

⚙️ sentry-react-native Build Distribution Settings

@github-actions
Copy link
Copy Markdown
Contributor

iOS (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3848.48 ms 1216.95 ms -2631.52 ms
Size 5.15 MiB 6.68 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a5d243c+dirty 3842.35 ms 1214.29 ms -2628.06 ms
5c1e987+dirty 1204.30 ms 1222.15 ms 17.85 ms
7d6fd3a+dirty 1223.29 ms 1229.57 ms 6.28 ms
5569641+dirty 3839.22 ms 1231.30 ms -2607.91 ms
5a21b51+dirty 3823.11 ms 1214.46 ms -2608.65 ms
4b87b12+dirty 1212.90 ms 1222.09 ms 9.19 ms
7ac3378+dirty 1213.37 ms 1218.15 ms 4.78 ms
890d145+dirty 1223.59 ms 1231.37 ms 7.78 ms
a50b33d+dirty 1197.74 ms 1197.17 ms -0.57 ms
ad66da3+dirty 3820.96 ms 1214.43 ms -2606.52 ms

App size

Revision Plain With Sentry Diff
a5d243c+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5c1e987+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
5a21b51+dirty 5.15 MiB 6.67 MiB 1.51 MiB
4b87b12+dirty 3.38 MiB 4.77 MiB 1.39 MiB
7ac3378+dirty 3.38 MiB 4.76 MiB 1.38 MiB
890d145+dirty 3.38 MiB 4.77 MiB 1.38 MiB
a50b33d+dirty 3.38 MiB 4.73 MiB 1.35 MiB
ad66da3+dirty 5.15 MiB 6.67 MiB 1.51 MiB

@github-actions
Copy link
Copy Markdown
Contributor

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 3818.41 ms 1212.09 ms -2606.32 ms
Size 5.15 MiB 6.68 MiB 1.53 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
a5d243c+dirty 3827.92 ms 1220.10 ms -2607.81 ms
5c1e987+dirty 1208.43 ms 1220.72 ms 12.29 ms
7d6fd3a+dirty 1210.89 ms 1217.63 ms 6.74 ms
5569641+dirty 3824.35 ms 1210.78 ms -2613.57 ms
5a21b51+dirty 3837.87 ms 1223.47 ms -2614.40 ms
4b87b12+dirty 1199.49 ms 1199.78 ms 0.29 ms
7ac3378+dirty 1202.35 ms 1198.31 ms -4.04 ms
890d145+dirty 1212.98 ms 1220.10 ms 7.12 ms
a50b33d+dirty 1207.11 ms 1212.10 ms 5.00 ms
ad66da3+dirty 3855.02 ms 1213.43 ms -2641.59 ms

App size

Revision Plain With Sentry Diff
a5d243c+dirty 5.15 MiB 6.68 MiB 1.53 MiB
5c1e987+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
5a21b51+dirty 5.15 MiB 6.67 MiB 1.51 MiB
4b87b12+dirty 3.38 MiB 4.77 MiB 1.39 MiB
7ac3378+dirty 3.38 MiB 4.76 MiB 1.38 MiB
890d145+dirty 3.38 MiB 4.77 MiB 1.38 MiB
a50b33d+dirty 3.38 MiB 4.73 MiB 1.35 MiB
ad66da3+dirty 5.15 MiB 6.67 MiB 1.51 MiB

@github-actions
Copy link
Copy Markdown
Contributor

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 405.38 ms 449.32 ms 43.94 ms
Size 48.30 MiB 53.58 MiB 5.28 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
ad66da3+dirty 411.49 ms 449.38 ms 37.89 ms
9210ae6+dirty 444.14 ms 459.80 ms 15.66 ms
5569641+dirty 465.92 ms 532.22 ms 66.30 ms
890d145+dirty 486.42 ms 514.85 ms 28.43 ms
3817909+dirty 357.52 ms 391.52 ms 34.00 ms
ef27341+dirty 519.02 ms 553.42 ms 34.40 ms
5a21b51+dirty 505.16 ms 539.20 ms 34.04 ms
d038a14+dirty 405.08 ms 444.36 ms 39.28 ms
8929511+dirty 469.49 ms 502.65 ms 33.16 ms
7ac3378+dirty 410.67 ms 442.60 ms 31.92 ms

App size

Revision Plain With Sentry Diff
ad66da3+dirty 48.30 MiB 53.49 MiB 5.19 MiB
9210ae6+dirty 48.30 MiB 53.54 MiB 5.23 MiB
5569641+dirty 48.30 MiB 53.48 MiB 5.18 MiB
890d145+dirty 43.94 MiB 49.00 MiB 5.06 MiB
3817909+dirty 43.94 MiB 48.94 MiB 5.00 MiB
ef27341+dirty 48.30 MiB 53.54 MiB 5.24 MiB
5a21b51+dirty 48.30 MiB 53.49 MiB 5.19 MiB
d038a14+dirty 48.30 MiB 53.49 MiB 5.19 MiB
8929511+dirty 43.94 MiB 49.02 MiB 5.08 MiB
7ac3378+dirty 43.94 MiB 48.99 MiB 5.05 MiB

@antonis antonis removed the ready-to-merge Triggers the full CI test suite label May 21, 2026
Comment thread CHANGELOG.md Outdated
Copy link
Copy Markdown

@cursor cursor Bot left a comment

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 00340cc. Configure here.

Comment thread packages/core/plugin/src/withSentryIOS.ts
…iters

On re-prebuild, addDisableAutoUploadToExistingScript was prepending
the export before the " delimiter that wraps shell script content in
pbxproj files. This places it inside the delimiter, consistent with
the fresh-prebuild path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
authToken?: string;
url?: string;
useNativeInit?: boolean;
disableAutoUpload?: boolean;
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.

might be worth checking the warden checks, not sure why it didnt post as a comment

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.

Provide a way to set SENTRY_DISABLE_AUTO_UPLOAD without access to the env (Expo managed projects)

2 participants