Skip to content

Commit 513aeb3

Browse files
antonisclaude
andauthored
fix(ios): Skip source maps upload on Debug builds (#6405)
* fix(ios): Skip source maps upload on Debug builds 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 <noreply@anthropic.com> * Update changelog --------- Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c6a8fa6 commit 513aeb3

3 files changed

Lines changed: 44 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@
66
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
77
<!-- prettier-ignore-end -->
88
9+
## Unreleased
10+
11+
### Fixes
12+
13+
- Skip iOS source maps upload on `Debug` builds ([#6405](https://github.com/getsentry/sentry-react-native/pull/6405))
14+
915
## 8.17.2
1016

1117
### Fixes

packages/core/scripts/sentry-xcode.sh

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,18 @@ REACT_NATIVE_XCODE_WITH_SENTRY="\"$SENTRY_CLI_EXECUTABLE\" react-native xcode $A
6565

6666
exitCode=0
6767

68-
if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
68+
if [ "$SENTRY_DISABLE_AUTO_UPLOAD" == true ]; then
69+
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload"
70+
/bin/sh -c "$REACT_NATIVE_XCODE"
71+
elif echo "$CONFIGURATION" | grep -iq "debug"; then # case insensitive check for "debug"
72+
# Skip the source maps upload for *Debug* configuration, matching the behavior of the
73+
# native debug files upload (sentry-xcode-debug-files.sh) and the Android Gradle plugin.
74+
# Local Debug builds should not require Sentry credentials. Still run the React Native
75+
# bundling step so the build itself succeeds.
76+
# See: https://github.com/getsentry/sentry-react-native/issues/6399
77+
echo "Skipping source maps upload for *Debug* configuration"
78+
/bin/sh -c "$REACT_NATIVE_XCODE"
79+
else
6980
# 'warning:' triggers a warning in Xcode, 'error:' triggers an error
7081
set +x +e # disable printing commands otherwise we might print `error:` by accident and allow continuing on error
7182
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
8293
fi
8394
fi
8495
set -x -e # re-enable
85-
else
86-
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping sourcemaps upload"
87-
/bin/sh -c "$REACT_NATIVE_XCODE"
8896
fi
8997

9098
[ -z "$SENTRY_COLLECT_MODULES" ] && SENTRY_RN_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/react-native/package.json'))")

packages/core/test/scripts/sentry-xcode-scripts.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,32 @@ describe('sentry-xcode.sh', () => {
455455
expect(result.stdout).toContain('skipping sourcemaps upload');
456456
});
457457

458+
it('skips upload for Debug configuration without invoking sentry-cli', () => {
459+
const result = runScript({
460+
CONFIGURATION: 'Debug',
461+
// A failing sentry-cli would surface here if it were invoked; the Debug skip must run
462+
// the React Native bundling step directly instead. See issue #6399.
463+
MOCK_CLI_EXIT_CODE: '1',
464+
MOCK_CLI_OUTPUT: 'An organization ID or slug is required',
465+
});
466+
467+
expect(result.exitCode).toBe(0);
468+
expect(result.stdout).toContain('Skipping source maps upload for *Debug* configuration');
469+
expect(result.stdout).toContain('Mock React Native bundle');
470+
expect(result.stdout).not.toContain('An organization ID or slug is required');
471+
expect(result.stdout).not.toContain('error: sentry-cli');
472+
});
473+
474+
it('skips upload for debug configuration (case insensitive)', () => {
475+
const result = runScript({
476+
CONFIGURATION: 'debug',
477+
});
478+
479+
expect(result.exitCode).toBe(0);
480+
expect(result.stdout).toContain('Skipping source maps upload for *Debug* configuration');
481+
expect(result.stdout).toContain('Mock React Native bundle');
482+
});
483+
458484
describe('SENTRY_PROJECT_ROOT override', () => {
459485
it('resolves SOURCEMAP_FILE relative to SENTRY_PROJECT_ROOT instead of PROJECT_DIR/..', () => {
460486
const customRoot = path.join(tempDir, 'monorepo-package');

0 commit comments

Comments
 (0)