Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS, Xcode] Upload Debug Files fails on HTTP error 4xx #3551

Closed
5 of 6 tasks
thefranfran opened this issue Jan 25, 2024 · 34 comments · Fixed by #3573
Closed
5 of 6 tasks

[iOS, Xcode] Upload Debug Files fails on HTTP error 4xx #3551

thefranfran opened this issue Jan 25, 2024 · 34 comments · Fixed by #3573

Comments

@thefranfran
Copy link

OS:

  • [] Windows
  • MacOS
  • [] Linux

Platform:

  • iOS
  • [] Android

SDK:

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

SDK version: 5.17.0

react-native version: 0.73.2

Are you using Expo?

  • [] Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • [] on-premise

Configuration:

(@sentry/react-native)

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

I have the following issue:

I installed the package with command npx @sentry/wizard@latest -s -i reactNative
and the metro config is setup aswell
It's look like it's an error during the execution of the Run Script Phase which is Upload Debug Symbols to Sentry
And the script is /bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh

Steps to reproduce:

  • npx @sentry/wizard@latest -s -i reactNative
  • Build project with XCode (15.0.1)

Actual result:
Command PhaseScriptExecution failed with a nonzero exit code
PhaseScriptExecution Upload\ Debug\ Symbols\ to\ Sentry

BuildFail.txt

@krystofwoldrich
Copy link
Member

Hi @thefranfran,
thank you for the message and the logs, sadly we don't se the cause of the crash in the logs.

Could you run the build again with this environmental variable and share the new logs?

export SENTRY_CLI_EXTRA_ARGS="--force-foreground --log-level=debug"

@getsantry getsantry bot moved this from Waiting for: Product Owner to Waiting for: Community in GitHub Issues with 👀 2 Jan 27, 2024
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Jan 27, 2024
@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Jan 27, 2024
@thefranfran
Copy link
Author

thefranfran commented Jan 29, 2024

Hi @krystofwoldrich,

Thank you for your feedback
I'd put the extra args as you mentioned in the Phase Script Upload Debug Symbols to Sentry

`[ -z "$WITH_ENVIRONMENT" ] && WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"

if [ -f "$WITH_ENVIRONMENT" ]; then
. "$WITH_ENVIRONMENT"
fi

LOCAL_NODE_BINARY=${NODE_BINARY:-node}

[ -z "$SENTRY_PROPERTIES" ] && export SENTRY_PROPERTIES=sentry.properties

[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_PACKAGE_PATH=$("$LOCAL_NODE_BINARY" --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))")
[ -z "$SENTRY_CLI_EXECUTABLE" ] && SENTRY_CLI_EXECUTABLE="${SENTRY_CLI_PACKAGE_PATH}/bin/sentry-cli"

[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""

EXTRA_ARGS="--force-foreground --log-level=debug $SENTRY_CLI_DEBUG_FILES_UPLOAD_EXTRA_ARGS $INCLUDE_SOURCES_FLAG"

UPLOAD_DEBUG_FILES=""$SENTRY_CLI_EXECUTABLE" debug-files upload $EXTRA_ARGS "$DWARF_DSYM_FOLDER_PATH""

if [ "$SENTRY_DISABLE_AUTO_UPLOAD" != true ]; then
/bin/sh -c ""$LOCAL_NODE_BINARY" $UPLOAD_DEBUG_FILES"
else
echo "SENTRY_DISABLE_AUTO_UPLOAD=true, skipping debug files upload"
fi`

I do not know if it will help you so tell me if it doesn't
Build 2024-01-29T16-41-19.txt

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 2 Jan 29, 2024
@krystofwoldrich
Copy link
Member

@thefranfran It seems like the output didn't change, how does your .xcode.env and .xcode.env.local looks like, it seem like the output log ends on the line NODE_BINARY=.

@thefranfran
Copy link
Author

@krystofwoldrich

my .xcode.env is

export NODE_BINARY=$(command -v node)
export SENTRY_CLI_EXTRA_ARGS="--force-foreground --log-level=debug"

and my .xcode.env.local is

export NODE_BINARY=/opt/homebrew/bin/node
export SENTRY_CLI_EXTRA_ARGS="--force-foreground --log-level=debug"

@lepskiy
Copy link

lepskiy commented Jul 11, 2024

Hi, I have similar issue. After upgrading to Expo 50 and migrating from sentry-expo to @sentry/react-native the build (using remote EAS Build) started failing with the next error:

› Executing MobileAppX » Bundle React Native code and images
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » MobileAppX/MobileAppX » Build Phases » 'Upload Debug Symbols to Sentry'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » MobileAppX/MobileAppX » Build Phases » 'Upload dSYMs to Datadog'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » MobileAppX/MobileAppX » Build Phases » '[CP-User] [RNFB] Core Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » MobileAppX/MobileAppX » Build Phases » '[CP-User] [RNFB] Crashlytics Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
▸ ** BUILD FAILED **
▸ The following build commands failed:
▸ 	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/workingdir/build/ios/build/Build/Intermediates.noindex/MobileAppX.build/Debug-iphonesimulator/MobileAppX.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'MobileAppX' from project 'MobileAppX')
▸ (1 failure)
** BUILD FAILED **
The following build commands failed:
	PhaseScriptExecution Bundle\ React\ Native\ code\ and\ images /Users/expo/workingdir/build/ios/build/Build/Intermediates.noindex/MobileAppX.build/Debug-iphonesimulator/MobileAppX.build/Script-00DD1BFF1BD5951E006B06BC.sh (in target 'MobileAppX' from project 'MobileAppX')
(1 failure)

Exit status: 65

These are the XCode logs:

    /bin/sh -c /Users/expo/workingdir/build/ios/build/Build/Intermediates.noindex/MobileAppX.build/Debug-iphonesimulator/MobileAppX.build/Script-00DD1BFF1BD5951E006B06BC.sh
+ LOCAL_NODE_BINARY=/Users/expo/.nvm/versions/node/v20.13.1/bin/node
+ '[' -z '' ']'
+ export SENTRY_PROPERTIES=sentry.properties
+ SENTRY_PROPERTIES=sentry.properties
+ '[' -z '' ']'
+ export SOURCEMAP_FILE=/Users/expo/workingdir/build/ios/build/Build/Intermediates.noindex/MobileAppX.build/Debug-iphonesimulator/MobileAppX.build/DerivedSources/main.jsbundle.map
+ SOURCEMAP_FILE=/Users/expo/workingdir/build/ios/build/Build/Intermediates.noindex/MobileAppX.build/Debug-iphonesimulator/MobileAppX.build/DerivedSources/main.jsbundle.map
+ '[' -z '' ']'
++ /Users/expo/.nvm/versions/node/v20.13.1/bin/node --print 'require('\''path'\'').dirname(require.resolve('\''@sentry/cli/package.json'\''))'
+ SENTRY_CLI_PACKAGE_PATH=/Users/expo/workingdir/build/node_modules/@sentry/cli
+ '[' -z '' ']'
+ SENTRY_CLI_EXECUTABLE=/Users/expo/workingdir/build/node_modules/@sentry/cli/bin/sentry-cli
+ REACT_NATIVE_XCODE=/Users/expo/workingdir/build/node_modules/react-native/scripts/react-native-xcode.sh
+ [[ '' == false ]]
+ ARGS=' --force-foreground --log-level=debug '
+ REACT_NATIVE_XCODE_WITH_SENTRY='"/Users/expo/workingdir/build/node_modules/@sentry/cli/bin/sentry-cli" react-native xcode  --force-foreground --log-level=debug  "/Users/expo/workingdir/build/node_modules/react-native/scripts/react-native-xcode.sh"'
+ '[' '' '!=' true ']'
+ /bin/sh -c '"/Users/expo/.nvm/versions/node/v20.13.1/bin/node" "/Users/expo/workingdir/build/node_modules/@sentry/cli/bin/sentry-cli" react-native xcode  --force-foreground --log-level=debug  "/Users/expo/workingdir/build/node_modules/react-native/scripts/react-native-xcode.sh"'
  INFO    2024-07-11 05:55:36.678262 -07:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)
  DEBUG   2024-07-11 05:55:36.701518 -07:00 sentry-cli version: 2.30.0, platform: "darwin", architecture: "arm64"
  INFO    2024-07-11 05:55:36.701557 -07:00 sentry-cli was invoked with the following command line: "/Users/expo/workingdir/build/node_modules/@sentry/cli-darwin/bin/sentry-cli" "react-native" "xcode" "--force-foreground" "--log-level=debug" "/Users/expo/workingdir/build/node_modules/react-native/scripts/react-native-xcode.sh"
  INFO    2024-07-11 05:55:36.701651 -07:00 Issuing a command for Organization: mpileappx Project: mpileappx
  INFO    2024-07-11 05:55:36.701658 -07:00 Using react-native build script at /Users/expo/workingdir/build/ios
  INFO    2024-07-11 05:55:36.701661 -07:00 Running in debug mode, skipping script wrapping.
+ DEST=/Users/expo/workingdir/build/ios/build/Build/Products/Debug-iphonesimulator/MobileAppX.app
+ [[ ! -n '' ]]
+ [[ Debug = *Debug* ]]
+ [[ ! iphonesimulator == *simulator ]]
+ [[ -n 1 ]]
+ echo 'SKIP_BUNDLING enabled; skipping.'
SKIP_BUNDLING enabled; skipping.
+ exit 0
+ '[' -z '' ']'
++ /Users/expo/.nvm/versions/node/v20.13.1/bin/node --print 'require('\''path'\'').dirname(require.resolve('\''@sentry/react-native/package.json'\''))'
+ SENTRY_RN_PACKAGE_PATH=/Users/expo/workingdir/build/node_modules/@sentry/react-native
+ '[' -z '' ']'
+ SENTRY_COLLECT_MODULES=/Users/expo/workingdir/build/node_modules/@sentry/react-native/scripts/collect-modules.sh
+ '[' -f /Users/expo/workingdir/build/node_modules/@sentry/react-native/scripts/collect-modules.sh ']'
+ /bin/sh /Users/expo/workingdir/build/node_modules/@sentry/react-native/scripts/collect-modules.sh
+ [[ Debug = *Debug* ]]
+ echo 'Debug build. Modules are not collected.'
Debug build. Modules are not collected.
+ exit 0
No sourcemap output has been specified.
Check that you either set a SOURCEMAP_FILE or an EXTRA_PACKAGER_ARGS environment variable in your "Bundle React Native code and images" Build Phase in XCode.
If you are not running this script from XCode, set a SOURCEMAP_FILE environment variable before running the script.
Command PhaseScriptExecution failed with a nonzero exit code

@arjunbanker
Copy link

Also seeing the exact same issue as @alterx, breaking on eas staging and production builds, can this issue be reopened until there is a resolution?

@charlestbell
Copy link

Happening again today.

@PhamQuyet1606
Copy link

still happens on the last version!

@felipejh
Copy link

felipejh commented Sep 9, 2024

Same here.

@bruno-garcia
Copy link
Member

bruno-garcia commented Sep 10, 2024

Is anyone experiencing intermittent errors with HTTP status 403?
If so, please comment/engage with:

We would like to solve any problem folks are having. To do that, please help us by providing some further context like: Your org slug. Times when it happened. How are you passing the org slug, auth token etc?

If your issue is not related to 403's, please raise a specific issue describing what the error is. Including debug logs (export SENTRY_LOG_LEVEL=debug) and the other info I mentioned is hugely helpful for us to track down what's going on.

@arjunbanker
Copy link

arjunbanker commented Sep 10, 2024 via email

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 10, 2024
@krystofwoldrich
Copy link
Member

I you are receiving 403 during the Debug Files Upload it's possible that the IP from where you are uploading the files is in range blocked by Google Cloud and so the request doesn't reach our servers.

To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true. If the upload fails you will have to upload the files manually following our guides -> https://docs.sentry.io/platforms/react-native/sourcemaps/

@krystofwoldrich krystofwoldrich changed the title [IOS] Upload Debug Symbols to Sentry failed on build [iOS, Xcode] Upload Debug Files fails on HTTP error 4xx Sep 13, 2024
@krystofwoldrich krystofwoldrich moved this from Done to Needs Discussion in Mobile & Cross Platform SDK Sep 13, 2024
@sergioisidoro
Copy link

sergioisidoro commented Sep 18, 2024

I think it is quite unacceptable that a service makes uploading the source code and symbols (a non critical task) fail the entire build if the step fails. The same happens if some error like Project not found. Please check that you entered the project and organization slugs correctly.

It's effectively making thousands of build processes dependent on Sentry's service availability.

This should be a warning, not a failure, and the default should be the other way arround (eg SENTRY_ABORT_BUILD_IF_FAIL or something similar)

Furthermore, I am working with multiple organizations, which have different access tokens, making the secret management quite challenging for testing local builds (ie, need to constantly change the token depending on the project, othewise step will fail)

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 3 Sep 18, 2024
@arjunbanker
Copy link

arjunbanker commented Sep 18, 2024 via email

@krystofwoldrich
Copy link
Member

Returned to needs discussion to look at #3551 (comment)

@krystofwoldrich
Copy link
Member

Thank you @sergioisidoro,
we appreciate the feedback.

We understand that by failing the build process we are creating a dependency on Sentry. The reason is delivering the best error experience we can. That means ensuring source maps are uploaded and thus errors are symbolicated and correctly grouped into issues.

If source maps upload would be only a warning, this could cause situations where if upload would fail and the app is unknowingly release without the source map uploaded new error would be created which would not be symbolicated, this could have larger consequences like triggering alerts and more.

We always include the message To disable source maps auto upload, set SENTRY_DISABLE_AUTO_UPLOAD=true in your environment variables. Or to allow failing upload, set SENTRY_ALLOW_FAILURE=true to make a failed upload as smooth experience as possible.

We close this issue as the original source of the 4xx error was resolved.

@github-project-automation github-project-automation bot moved this from Needs Discussion to Done in Mobile & Cross Platform SDK Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Archived in project
Archived in project
Development

Successfully merging a pull request may close this issue.