feat(core): Add disableAutoUpload option to Expo plugin
#6195
4 issues
find-bugs: Found 4 issues (3 medium, 1 low)
Medium
`disableAutoUpload: false` does not remove the override injected by a prior `disableAutoUpload: true` run - `packages/core/plugin/src/withSentry.ts:21`
Once expo prebuild is run with disableAutoUpload: true, the shouldSentryAutoUploadGeneral = { -> return false } line is permanently baked into build.gradle. Re-running prebuild with disableAutoUpload: false silently does nothing โ uploads remain disabled, violating user expectations.
Also found at:
packages/core/plugin/src/withSentryAndroid.ts:42-49packages/core/test/expo-plugin/modifyAppBuildGradle.test.ts:61-63packages/core/test/expo-plugin/modifyXcodeProject.test.ts:3
`export SENTRY_DISABLE_AUTO_UPLOAD=true` is never removed from Xcode build phases when `disableAutoUpload` toggles back to `false` - `packages/core/plugin/src/withSentryIOS.ts:70-76`
After running prebuild with disableAutoUpload: true, changing to disableAutoUpload: false and re-running prebuild silently keeps export SENTRY_DISABLE_AUTO_UPLOAD=true in both Xcode build phases, so auto-upload remains disabled.
Also found at:
packages/core/plugin/src/withSentryIOS.ts:46-52packages/core/test/expo-plugin/modifyXcodeProject.test.ts:3packages/core/test/expo-plugin/modifyXcodeProject.test.ts:133-137
`shouldSentryAutoUploadGeneral` override never removed when `disableAutoUpload` is toggled back to `false`
In withSentryAndroid.ts, modifyAppBuildGradle only injects project.ext.shouldSentryAutoUploadGeneral = { -> return false } โ it never removes it. Switching from disableAutoUpload: true to false and re-running prebuild leaves the override in build.gradle, permanently disabling Android source-map uploads.
Low
Misleading 'script already exists' warning emitted after successfully injecting SENTRY_DISABLE_AUTO_UPLOAD into existing iOS bundle script - `packages/core/plugin/src/withSentry.ts:76`
In modifyExistingXcodeBuildScript (withSentryIOS.ts), when the bundle phase already contains sentry-xcode.sh and disableAutoUpload=true, addDisableAutoUploadToExistingScript(script) is invoked and may actually mutate script.shellScript to inject export SENTRY_DISABLE_AUTO_UPLOAD=true. However, the subsequent warnOnce("The latest 'sentry-xcode.sh' script already exists...") runs unconditionally, telling the user nothing was done even though a real change was made. The fix is to return after the injection (or only warn when no mutation occurred).
โฑ 7m 17s ยท 456.2k in / 48.0k out ยท $2.09
Annotations
Check warning on line 21 in packages/core/plugin/src/withSentry.ts
sentry-warden / warden: find-bugs
`disableAutoUpload: false` does not remove the override injected by a prior `disableAutoUpload: true` run
Once `expo prebuild` is run with `disableAutoUpload: true`, the `shouldSentryAutoUploadGeneral = { -> return false }` line is permanently baked into `build.gradle`. Re-running prebuild with `disableAutoUpload: false` silently does nothing โ uploads remain disabled, violating user expectations.
Check warning on line 49 in packages/core/plugin/src/withSentryAndroid.ts
sentry-warden / warden: find-bugs
[CVS-2BB] `disableAutoUpload: false` does not remove the override injected by a prior `disableAutoUpload: true` run (additional location)
Once `expo prebuild` is run with `disableAutoUpload: true`, the `shouldSentryAutoUploadGeneral = { -> return false }` line is permanently baked into `build.gradle`. Re-running prebuild with `disableAutoUpload: false` silently does nothing โ uploads remain disabled, violating user expectations.
Check warning on line 63 in packages/core/test/expo-plugin/modifyAppBuildGradle.test.ts
sentry-warden / warden: find-bugs
[CVS-2BB] `disableAutoUpload: false` does not remove the override injected by a prior `disableAutoUpload: true` run (additional location)
Once `expo prebuild` is run with `disableAutoUpload: true`, the `shouldSentryAutoUploadGeneral = { -> return false }` line is permanently baked into `build.gradle`. Re-running prebuild with `disableAutoUpload: false` silently does nothing โ uploads remain disabled, violating user expectations.
Check warning on line 3 in packages/core/test/expo-plugin/modifyXcodeProject.test.ts
sentry-warden / warden: find-bugs
[CVS-2BB] `disableAutoUpload: false` does not remove the override injected by a prior `disableAutoUpload: true` run (additional location)
Once `expo prebuild` is run with `disableAutoUpload: true`, the `shouldSentryAutoUploadGeneral = { -> return false }` line is permanently baked into `build.gradle`. Re-running prebuild with `disableAutoUpload: false` silently does nothing โ uploads remain disabled, violating user expectations.
Check warning on line 76 in packages/core/plugin/src/withSentryIOS.ts
sentry-warden / warden: find-bugs
`export SENTRY_DISABLE_AUTO_UPLOAD=true` is never removed from Xcode build phases when `disableAutoUpload` toggles back to `false`
After running prebuild with `disableAutoUpload: true`, changing to `disableAutoUpload: false` and re-running prebuild silently keeps `export SENTRY_DISABLE_AUTO_UPLOAD=true` in both Xcode build phases, so auto-upload remains disabled.
Check warning on line 52 in packages/core/plugin/src/withSentryIOS.ts
sentry-warden / warden: find-bugs
[MVS-QQ9] `export SENTRY_DISABLE_AUTO_UPLOAD=true` is never removed from Xcode build phases when `disableAutoUpload` toggles back to `false` (additional location)
After running prebuild with `disableAutoUpload: true`, changing to `disableAutoUpload: false` and re-running prebuild silently keeps `export SENTRY_DISABLE_AUTO_UPLOAD=true` in both Xcode build phases, so auto-upload remains disabled.
Check warning on line 3 in packages/core/test/expo-plugin/modifyXcodeProject.test.ts
sentry-warden / warden: find-bugs
[MVS-QQ9] `export SENTRY_DISABLE_AUTO_UPLOAD=true` is never removed from Xcode build phases when `disableAutoUpload` toggles back to `false` (additional location)
After running prebuild with `disableAutoUpload: true`, changing to `disableAutoUpload: false` and re-running prebuild silently keeps `export SENTRY_DISABLE_AUTO_UPLOAD=true` in both Xcode build phases, so auto-upload remains disabled.
Check warning on line 137 in packages/core/test/expo-plugin/modifyXcodeProject.test.ts
sentry-warden / warden: find-bugs
[MVS-QQ9] `export SENTRY_DISABLE_AUTO_UPLOAD=true` is never removed from Xcode build phases when `disableAutoUpload` toggles back to `false` (additional location)
After running prebuild with `disableAutoUpload: true`, changing to `disableAutoUpload: false` and re-running prebuild silently keeps `export SENTRY_DISABLE_AUTO_UPLOAD=true` in both Xcode build phases, so auto-upload remains disabled.