Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
<!-- prettier-ignore-end -->

## Unreleased

### Fixes

- Skip iOS source maps upload on `Debug` builds ([#6405](https://github.com/getsentry/sentry-react-native/pull/6405))

## 8.17.2

### Fixes
Expand Down
16 changes: 12 additions & 4 deletions packages/core/scripts/sentry-xcode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

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.

Looking good! But, what about using ENABLE_TESTABILITY instead of CONFIGURATION?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good question @lucas-zimerman ๐Ÿ‘ I used configuration mainly to align with sentry-xcode-debug-files.sh. I'll need to check and possibly refactor both places. Wdyt of following up on this separately?

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.

sounds good to me!

# 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)
Expand All @@ -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'))")
Expand Down
26 changes: 26 additions & 0 deletions packages/core/test/scripts/sentry-xcode-scripts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Loading