sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Expo iOS EAS build fails even if `--allow-failures` is set

Open csvan opened this issue 11 months ago • 6 comments

OS:

  • [ ] Windows
  • [x] MacOS
  • [ ] Linux

Platform:

  • [x] iOS
  • [ ] Android

SDK:

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

SDK version: 5.19.1 (Expo 50)

react-native version: 0.73.4

Are you using Expo?

  • [x] Yes
  • [ ] No

Are you using sentry.io or on-premise?

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

If you are using sentry.io, please post a link to your issue so we can take a look:

[Link to issue]

Configuration:

(@sentry/react-native)

Sentry.init({
  beforeSend: (event) => {
    event.tags = {
      ...(event.tags || {}),
      app: 'my-app',
    };
    return event;
  },
  dsn: 'https://xxx@xxx',
});


I have the following issue:

We use @sentry/react-native in our Expo app, it works without issue locally and for Android builds. However, for iOS builds we hit the following:

Executing MyApp » [CP] Copy Pods Resources
› Executing MyApp » Upload Debug Symbols to Sentry

❌  error: API request failed

⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » MyApp/MyApp » Build Phases » 'Upload Debug Symbols to Sentry'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script
▸ ** ARCHIVE FAILED **
▸ The following build commands failed:
▸ 	PhaseScriptExecution Upload\ Debug\ Symbols\ to\ Sentry /Users/expo/Library/Developer/Xcode/DerivedData/MyApp-cdmeqqhysgdhshcijpdvuuaouuix/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/Script-C9976DD65AD34B99A90A9F59.sh (in target 'MyApp' from project 'MyApp')
▸ (1 failure)
** ARCHIVE FAILED **
The following build commands failed:
	PhaseScriptExecution Upload\ Debug\ Symbols\ to\ Sentry /Users/expo/Library/Developer/Xcode/DerivedData/MyApp-cdmeqqhysgdhshcijpdvuuaouuix/Build/Intermediates.noindex/ArchiveIntermediates/MyApp/IntermediateBuildFilesPath/MyApp.build/Release-iphoneos/MyApp.build/Script-C9976DD65AD34B99A90A9F59.sh (in target 'MyApp' from project 'MyApp')
(1 failure)

Exit status: 65

However, we have set the following env var:

"SENTRY_CLI_DEBUG_FILES_UPLOAD_EXTRA_ARGS": "--allow-failure"

And the XCode logs suggest that this is being respected:

 DEBUG   2024-03-12 06:46:18.311485 -07:00 body: {"60d723c87188fb732259aec461b7f863975bcd14":{"state":"not_found","missingChunks":["96499e94a6a09ebe1c12d080a74a0b1f0aa8250b","61fd705b87ddfb73cfb74a93e1afbd96cfc1bc12","d596e287da7fe76b6361d58bb4167940ac9d7435","f1aecb520cbcdf98b6a1765a0a36a842b4271634","594567617dc5666323d3ba1c73d5298105676fd3","015ef50d06bc761521f71d3073406c9d50b584dd","8b65288f0cf8c89c412910485b7cddc49ed7982b","1d67957e810957cb829ad39dc6ded95ac4ff3822","aab97e232e9ecc2090fff7c752d86f8d48ce07af","e045013892dfc577dc95617650f0624a740f4dd2","3a1e9dc6205a47de372f69fc67e5a3ca9b48adb6","189a6e5bca5a3b8994883f7d1c9314c403694844"]},"fd2ff9f2ca5c043e65d0e64181095ab05333dea8":{"state":"not_found","missingChunks":["fd2ff9f2ca5c043e65d0e64181095ab05333dea8"]},"ee6149cc80d9d4453fe7a3beaad073d70c05ea5a":{"state":"not_found","missingChunks":["aa3bc760eee4706b67e72f3ff3348ab513f27282","29584cf5ff894e4390557bc1ed729a77b6bfb537","5d2f7e5ef8449a1ea0222d1f0461a9f59204fb04"]}}
error: API request failed
  caused by: sentry reported an error: unknown error (http status: 413)

Command failed, however, "SENTRY_ALLOW_FAILURE" variable or "allow-failure" flag was set. Exiting with 0 exit code.
Command PhaseScriptExecution emitted errors but did not return a nonzero exit code to indicate failure

Nevertheless, the build fails. We have identified what causes the 413 and will address that, but I feel like this behaviour is unexpected either way.

Removing the Sentry plugin from our Expo app config causes the build to pass, so it is almost certainly the root cause.

[Description]

Steps to reproduce:

  • Setup vanilla onprem sentry
  • integrate @sentry/react-native with Expo app
  • Trigger iOS build

Actual result:

Entire build process fails

Expected result:

Build should go green even if Sentry dsym upload fails

csvan avatar Mar 12 '24 15:03 csvan

Hi @csvan, thank you for the message, do you have any more information about the failed build?

The flag --allow-failure forces the CLI to return code 0, but error logs are still printed to the stderr. In the case of Xcode, the build should finish with errors, which is the expected behavior.

krystofwoldrich avatar Mar 13 '24 09:03 krystofwoldrich

@krystofwoldrich sorry if I am misunderstanding the purpose of --allow-failures in that case, I thought it was specifically to not break the build as a whole if dsym upload fails. I believe you said something to that effect here (but again, sorry if I misunderstood): https://github.com/getsentry/sentry-react-native/issues/3674#issuecomment-1988176225

The build itself is a pretty vanilla Expo project, we don't really do any custom tweaks outside of what Expo allows. The integration with @sentry/react-native is a per the documentation without any deviations.

I can send you the xcode logs privately if you want, but there isn't that much after the failed Sentry step.

csvan avatar Mar 13 '24 09:03 csvan

@csvan Thank you for the message, your expectations are correct, the build with the flag should finish and produce an archive.

There might be a small difference between running Xcode on a desktop and in EAS. We will check it.

krystofwoldrich avatar Mar 14 '24 09:03 krystofwoldrich

@krystofwoldrich thanks!

csvan avatar Mar 14 '24 14:03 csvan

I'm having the same issue. It fails both locally and on EAS even with the --allow-failure flag set. In order to build my app I had to set SENTRY_DISABLE_AUTO_UPLOAD = true. It happens only on iOS.

otaviogaiao avatar May 01 '24 17:05 otaviogaiao

Hi @otaviogaiao, thank you for the message, could you share on what error the build failed and what was the command you used to build your app locally?

krystofwoldrich avatar May 02 '24 15:05 krystofwoldrich

The reason why Xcode build fails is sentry-cli output prefixed by error:.

  • Will be fixed by https://github.com/getsentry/sentry-react-native/pull/3887

krystofwoldrich avatar Jun 12 '24 17:06 krystofwoldrich

i can confirm, is fixed in >= 5.24.0

carlosen14 avatar Jul 05 '24 22:07 carlosen14

@carlosen14 Thank you!

krystofwoldrich avatar Jul 08 '24 09:07 krystofwoldrich