Skip to content

[Xcode, Sentry CLI] Upload fails in background #2148

@trooperandz

Description

@trooperandz

OS:

  • Windows
  • MacOS (14.5)
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 5.31.1

react-native version: 0.73.7

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:
(I do not have a link that I know of)

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://...sentry.io...'
});

I have the following issue:

When attempting to upload source maps and debug symbols for iOS during the release build process, the Sentry uploads only work when the foreground flag is enabled: export SENTRY_CLI_EXTRA_ARGS="--force-foreground". If the foreground flag is not set, we see in the MacOS crash logs that the sentry-cli is crashing during execution. This is with the sentry-cli version 2.34.0.

Steps to reproduce:

  • Step 1
    After running the sentry wizard to enable source map uploads (npx @sentry/wizard@latest -i reactNative), ensure that the following content in the "Bundle React Native code and images" build phase is as follows:
set -e

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
SENTRY_XCODE="../node_modules/@sentry/react-native/scripts/sentry-xcode.sh"
BUNDLE_REACT_NATIVE="/bin/sh $SENTRY_XCODE $REACT_NATIVE_XCODE"
/bin/sh -c "$WITH_ENVIRONMENT \"$BUNDLE_REACT_NATIVE\""

Additionally, ensure that the "Upload Debug Symbols to Sentry" build phase has the following content:

/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh
  • Step 2
    Run a Release build in Xcode until successful completion, and observe that during the build process, system notifications appear for both build phases:

Image

  • Step 3
    Observe that system notifications never show for the Sentry completion, and that no source map release artifact or debug files have been uploaded to your Sentry project dashboard. Also observe that in the MacOS Console.app crash logs, there are two crash reports for the sentry-cli:

Image

  • Step 4
    Add the following to your .xcode.env file: export SENTRY_CLI_EXTRA_ARGS="--force-foreground" and run another Release build in Xcode.

  • Step 5
    Observe that the Sentry source map uploads were successful, and that debug files and a release artifact appears in your project dashboard.

Actual result:
Before adding the export SENTRY_CLI_EXTRA_ARGS="--force-foreground" environment variable, no debug files or source map uploads occur.

Expected result:
Source map uploads should occur regardless of the --force-foreground flag.

Supporting logs and crash report details (see attachments)

sentry-logs-from-failed-upload.txt
sentry-cli-crash1.txt
sentry-cli-crash2.txt

Sub-issues

Metadata

Metadata

Labels

No labels
No labels

Projects

Status

Done

Status

No status

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions