From c9e6ece38b6a5be21439c304fdf5577dfa7cd2ee Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Mon, 6 Jul 2026 10:04:31 +0200 Subject: [PATCH 1/2] fix(ios): Skip source maps upload on Debug builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The source-maps upload phase (sentry-xcode.sh) ran sentry-cli for every configuration, including Debug. Since sentry-cli v3 hard-fails without an org/auth token, local Debug builds without Sentry credentials fail with "An organization ID or slug is required" — whereas 7.x warned and continued. Add a *Debug* configuration guard, matching the native debug files upload (sentry-xcode-debug-files.sh) and the Android Gradle plugin. Debug builds now skip the upload and run the React Native bundling step directly. Fixes #6399 Co-Authored-By: Claude Opus 4.8 --- CHANGELOG.md | 6 +++++ packages/core/scripts/sentry-xcode.sh | 16 +++++++++--- .../test/scripts/sentry-xcode-scripts.test.ts | 26 +++++++++++++++++++ 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22f79938f0..aade0cd99b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,12 @@ > make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first. +## Unreleased + +### Fixes + +- Skip iOS source maps upload on `Debug` builds ([#6399](https://github.com/getsentry/sentry-react-native/issues/6399)) + ## 8.17.1 ### Fixes diff --git a/packages/core/scripts/sentry-xcode.sh b/packages/core/scripts/sentry-xcode.sh index aa4ead6225..1a44688e99 100755 --- a/packages/core/scripts/sentry-xcode.sh +++ b/packages/core/scripts/sentry-xcode.sh @@ -65,7 +65,18 @@ REACT_NATIVE_XCODE_WITH_SENTRY="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $A exitCode=0 -if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then +if [ "$SENTRY_DISABLE_AUTO_UPLOAD" == true ]; then + echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload" + /bin/sh -c "$REACT_NATIVE_XCODE" +elif echo "$CONFIGURATION" | grep -iq "debug"; then # case insensitive check for "debug" + # Skip the source maps upload for *Debug* configuration, matching the behavior of the + # native debug files upload (sentry-xcode-debug-files.sh) and the Android Gradle plugin. + # Local Debug builds should not require Sentry credentials. Still run the React Native + # bundling step so the build itself succeeds. + # See: https://github.com/getsentry/sentry-react-native/issues/6399 + echo "Skipping source maps upload for *Debug* configuration" + /bin/sh -c "$REACT_NATIVE_XCODE" +else # 'warning:' triggers a warning in Xcode, 'error:' triggers an error set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error SENTRY_XCODE_COMMAND_OUTPUT=$(/bin/sh -c "\"$LOCAL_NODE_BINARY\" $REACT_NATIVE_XCODE_WITH_SENTRY" 2>&1) @@ -82,9 +93,6 @@ if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then fi fi set -x -e # re-enable -else - echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload" - /bin/sh -c "$REACT_NATIVE_XCODE" fi [ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_RN_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/react-native/package.json'))") diff --git a/packages/core/test/scripts/sentry-xcode-scripts.test.ts b/packages/core/test/scripts/sentry-xcode-scripts.test.ts index 90eedcd6c8..3a65af4cae 100644 --- a/packages/core/test/scripts/sentry-xcode-scripts.test.ts +++ b/packages/core/test/scripts/sentry-xcode-scripts.test.ts @@ -455,6 +455,32 @@ describe('sentry-xcode.sh', () => { expect(result.stdout).toContain('skipping sourcemaps upload'); }); + it('skips upload for Debug configuration without invoking sentry-cli', () => { + const result = runScript({ + CONFIGURATION: 'Debug', + // A failing sentry-cli would surface here if it were invoked; the Debug skip must run + // the React Native bundling step directly instead. See issue #6399. + MOCK_CLI_EXIT_CODE: '1', + MOCK_CLI_OUTPUT: 'An organization ID or slug is required', + }); + + expect(result.exitCode).toBe(0); + expect(result.stdout).toContain('Skipping source maps upload for *Debug* configuration'); + expect(result.stdout).toContain('Mock React Native bundle'); + expect(result.stdout).not.toContain('An organization ID or slug is required'); + expect(result.stdout).not.toContain('error: sentry-cli'); + }); + + it('skips upload for debug configuration (case insensitive)', () => { + const result = runScript({ + CONFIGURATION: 'debug', + }); + + expect(result.exitCode).toBe(0); + expect(result.stdout).toContain('Skipping source maps upload for *Debug* configuration'); + expect(result.stdout).toContain('Mock React Native bundle'); + }); + describe('SENTRY_PROJECT_ROOT override', () => { it('resolves SOURCEMAP_FILE relative to SENTRY_PROJECT_ROOT instead of PROJECT_DIR/..', () => { const customRoot = path.join(tempDir, 'monorepo-package'); From 39d7067a394fea178d5a6ea35acd7170975068d7 Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Mon, 6 Jul 2026 10:12:40 +0200 Subject: [PATCH 2/2] Update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index aade0cd99b..c6ceea7dff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ### Fixes -- Skip iOS source maps upload on `Debug` builds ([#6399](https://github.com/getsentry/sentry-react-native/issues/6399)) +- Skip iOS source maps upload on `Debug` builds ([#6405](https://github.com/getsentry/sentry-react-native/pull/6405)) ## 8.17.1