feat(core): Add disableAutoUpload option to Expo plugin
#6195
5 issues
find-bugs: Found 5 issues (3 medium, 2 low)
Medium
`disableAutoUpload: false` does not remove `export SENTRY_DISABLE_AUTO_UPLOAD=true` from Xcode build phases on re-prebuild - `packages/core/plugin/src/withSentry.ts:88`
If a project was previously prebuilt with disableAutoUpload: true and is prebuilt again with disableAutoUpload: false (or the option omitted), the export SENTRY_DISABLE_AUTO_UPLOAD=true line remains in both the 'Bundle React Native code and images' and 'Upload Debug Symbols to Sentry' shell scripts. Neither modifyExistingXcodeBuildScript nor the existing-sentryBuildPhase branch in withSentryIOS removes the export when disableAutoUpload is false, and addDisableAutoUploadToExistingScript only adds the line. As a result, toggling the option off does not actually re-enable auto-upload on iOS without a --clean prebuild.
Also found at:
packages/core/plugin/src/withSentryAndroid.ts:72-79packages/core/plugin/src/withSentryIOS.ts:70-76packages/core/test/expo-plugin/modifyXcodeProject.test.ts:2
`shouldSentryAutoUploadGeneral` override is never removed when `disableAutoUpload` switches back to `false` - `packages/core/plugin/src/withSentryAndroid.ts:45-52`
When disableAutoUpload is toggled from true to false and prebuild is re-run, the project.ext.shouldSentryAutoUploadGeneral = { -> return false } line stays in build.gradle and uploads remain disabled โ contradicting the user's new config.
Also found at:
packages/core/plugin/src/withSentry.ts:71packages/core/test/expo-plugin/modifyAppBuildGradle.test.ts:64-67
`shouldSentryAutoUploadGeneral` override never removed when `disableAutoUpload` changes from `true` to `false`
In modifyAppBuildGradle (withSentryAndroid.ts), when sentry.gradle is already present and disableAutoUpload is false, the function returns the file unchanged โ meaning a previously injected shouldSentryAutoUploadGeneral = { -> return false } override persists and continues suppressing uploads even after the user opts back in.
Low
Misleading "already exists" warning fires after `disableAutoUpload` patches the existing bundle script - `packages/core/plugin/src/withSentryAndroid.ts:72-79`
In modifyExistingXcodeBuildScript, when script.shellScript.includes('sentry-xcode.sh') is true and disableAutoUpload is set, addDisableAutoUploadToExistingScript(script) mutates the script to inject export SENTRY_DISABLE_AUTO_UPLOAD=true. Immediately after, warnOnce("The latest 'sentry-xcode.sh' script already exists in 'Bundle React Native code and images'.") is called unconditionally, producing a warning that implies nothing was done โ even though the script was just meaningfully updated. Consider suppressing the warning (or rewording it) when disableAutoUpload triggered an actual mutation.
Also found at:
packages/core/test/expo-plugin/modifyXcodeProject.test.ts:109-118
Android `shouldSentryAutoUploadGeneral` override is never removed when `disableAutoUpload` toggles from `true` to `false` - `packages/core/test/expo-plugin/modifyXcodeProject.test.ts:2`
In withSentryAndroid.ts modifyAppBuildGradle, when sentry.gradle is already present and disableAutoUpload is false, the function returns the file unchanged โ leaving any previously injected project.ext.shouldSentryAutoUploadGeneral = { -> return false } in place. Re-running expo prebuild (without --clean) after toggling disableAutoUpload: true โ false therefore keeps Android auto-upload disabled silently, contrary to the PR's idempotency claim. (The iOS path via addDisableAutoUploadToExistingScript has the same one-way behavior for the injected export SENTRY_DISABLE_AUTO_UPLOAD=true.)
โฑ 9m 54s ยท 484.1k in / 69.0k out ยท $2.57
Annotations
Check warning on line 88 in packages/core/plugin/src/withSentry.ts
sentry-warden / warden: find-bugs
`disableAutoUpload: false` does not remove `export SENTRY_DISABLE_AUTO_UPLOAD=true` from Xcode build phases on re-prebuild
If a project was previously prebuilt with `disableAutoUpload: true` and is prebuilt again with `disableAutoUpload: false` (or the option omitted), the `export SENTRY_DISABLE_AUTO_UPLOAD=true` line remains in both the 'Bundle React Native code and images' and 'Upload Debug Symbols to Sentry' shell scripts. Neither `modifyExistingXcodeBuildScript` nor the existing-`sentryBuildPhase` branch in `withSentryIOS` removes the export when `disableAutoUpload` is false, and `addDisableAutoUploadToExistingScript` only adds the line. As a result, toggling the option off does not actually re-enable auto-upload on iOS without a `--clean` prebuild.
Check warning on line 79 in packages/core/plugin/src/withSentryAndroid.ts
sentry-warden / warden: find-bugs
[VWK-SSV] `disableAutoUpload: false` does not remove `export SENTRY_DISABLE_AUTO_UPLOAD=true` from Xcode build phases on re-prebuild (additional location)
If a project was previously prebuilt with `disableAutoUpload: true` and is prebuilt again with `disableAutoUpload: false` (or the option omitted), the `export SENTRY_DISABLE_AUTO_UPLOAD=true` line remains in both the 'Bundle React Native code and images' and 'Upload Debug Symbols to Sentry' shell scripts. Neither `modifyExistingXcodeBuildScript` nor the existing-`sentryBuildPhase` branch in `withSentryIOS` removes the export when `disableAutoUpload` is false, and `addDisableAutoUploadToExistingScript` only adds the line. As a result, toggling the option off does not actually re-enable auto-upload on iOS without a `--clean` prebuild.
Check warning on line 76 in packages/core/plugin/src/withSentryIOS.ts
sentry-warden / warden: find-bugs
[VWK-SSV] `disableAutoUpload: false` does not remove `export SENTRY_DISABLE_AUTO_UPLOAD=true` from Xcode build phases on re-prebuild (additional location)
If a project was previously prebuilt with `disableAutoUpload: true` and is prebuilt again with `disableAutoUpload: false` (or the option omitted), the `export SENTRY_DISABLE_AUTO_UPLOAD=true` line remains in both the 'Bundle React Native code and images' and 'Upload Debug Symbols to Sentry' shell scripts. Neither `modifyExistingXcodeBuildScript` nor the existing-`sentryBuildPhase` branch in `withSentryIOS` removes the export when `disableAutoUpload` is false, and `addDisableAutoUploadToExistingScript` only adds the line. As a result, toggling the option off does not actually re-enable auto-upload on iOS without a `--clean` prebuild.
Check warning on line 2 in packages/core/test/expo-plugin/modifyXcodeProject.test.ts
sentry-warden / warden: find-bugs
[VWK-SSV] `disableAutoUpload: false` does not remove `export SENTRY_DISABLE_AUTO_UPLOAD=true` from Xcode build phases on re-prebuild (additional location)
If a project was previously prebuilt with `disableAutoUpload: true` and is prebuilt again with `disableAutoUpload: false` (or the option omitted), the `export SENTRY_DISABLE_AUTO_UPLOAD=true` line remains in both the 'Bundle React Native code and images' and 'Upload Debug Symbols to Sentry' shell scripts. Neither `modifyExistingXcodeBuildScript` nor the existing-`sentryBuildPhase` branch in `withSentryIOS` removes the export when `disableAutoUpload` is false, and `addDisableAutoUploadToExistingScript` only adds the line. As a result, toggling the option off does not actually re-enable auto-upload on iOS without a `--clean` prebuild.
Check warning on line 52 in packages/core/plugin/src/withSentryAndroid.ts
sentry-warden / warden: find-bugs
`shouldSentryAutoUploadGeneral` override is never removed when `disableAutoUpload` switches back to `false`
When `disableAutoUpload` is toggled from `true` to `false` and prebuild is re-run, the `project.ext.shouldSentryAutoUploadGeneral = { -> return false }` line stays in `build.gradle` and uploads remain disabled โ contradicting the user's new config.
Check warning on line 71 in packages/core/plugin/src/withSentry.ts
sentry-warden / warden: find-bugs
[EVY-6SJ] `shouldSentryAutoUploadGeneral` override is never removed when `disableAutoUpload` switches back to `false` (additional location)
When `disableAutoUpload` is toggled from `true` to `false` and prebuild is re-run, the `project.ext.shouldSentryAutoUploadGeneral = { -> return false }` line stays in `build.gradle` and uploads remain disabled โ contradicting the user's new config.
Check warning on line 67 in packages/core/test/expo-plugin/modifyAppBuildGradle.test.ts
sentry-warden / warden: find-bugs
[EVY-6SJ] `shouldSentryAutoUploadGeneral` override is never removed when `disableAutoUpload` switches back to `false` (additional location)
When `disableAutoUpload` is toggled from `true` to `false` and prebuild is re-run, the `project.ext.shouldSentryAutoUploadGeneral = { -> return false }` line stays in `build.gradle` and uploads remain disabled โ contradicting the user's new config.