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

xcode: Upload Debug Symbols to Sentry has ambiguos dependencies

Open Yonom opened this issue 1 year ago • 31 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.16.0

react-native version: 0.73.2

Are you using Expo?

  • [x] Yes, SDK 50
  • [ ] No

Are you using sentry.io or on-premise?

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

I have the following issue:

During build, I see a warning regarding an ambiguous dependency. I am using the "@sentry/react-native/expo" config plugin.

Steps to reproduce:

  • Step 1: Install Sentry in a new Expo project
  • Step 2: Run npx expo run ios and observe the logs

Actual result:

I see the following warning:

⚠️ Script has ambiguous dependencies causing it to run on every build. To fix, go to: Xcode » App/App » Build Phases » 'Upload Debug Symbols to Sentry' Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

Expected result:

I expected no warnings.

Yonom avatar Jan 21 '24 13:01 Yonom

@Yonom This is appears to be causing builds to fail during eas build process for both iOS and Android. Locally things appear to be working after following the migration guide provided by the Expo team.

iM-GeeKy avatar Jan 22 '24 13:01 iM-GeeKy

My EAS builds work just fine despite the warning

Yonom avatar Jan 22 '24 13:01 Yonom

My EAS builds work just fine despite the warning

Thanks for the quick response. I noticed this upgrading from 49 to 50 and following their migration guide. My issue appears to be sentry related and I was seeing the warning as well.

* Where:
Script '/home/expo/workingdir/build/node_modules/@sentry/react-native/sentry.gradle' line: 143

iM-GeeKy avatar Jan 22 '24 14:01 iM-GeeKy

@Yonom Thank you for the message, we will update the build phase to remove the warning.

Note: We want it to run on every build, so the current behavior is correct. Just the script is not correctly marked in Xcode.

krystofwoldrich avatar Jan 22 '24 17:01 krystofwoldrich

@iM-GeeKy Can you open a new issue for the Android build failure and if possible share a large portion of the build log output?

krystofwoldrich avatar Jan 22 '24 17:01 krystofwoldrich

@iM-GeeKy Can you open a new issue for the Android build failure and if possible share a large portion of the build log output?

Sure thing, I'll do that in a couple of hours when I'm back at my laptop. The issue appeared to be happening on iOS and Android. I'm make sure to attach as much of the build log as possible.

iM-GeeKy avatar Jan 22 '24 17:01 iM-GeeKy

This is not the reason the build is failing, if you scroll up in your logs you should see the actual failure reason. This is just outputted at the bottom of the Fastlane log output. It does not cause the build to fail.

TreeMan360 avatar Jan 23 '24 13:01 TreeMan360

This needs to be updated in the sentry-wizard and @sentry/react-native/expo as well as in the manual setup docs.

krystofwoldrich avatar Jan 26 '24 13:01 krystofwoldrich

We are running into this issue as well using Expo. We have a SENTRY_AUTH_TOKEN as a global env var in our organization's settings in Expo.

Error

Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Development/Development » Build Phases » 'Upload Debug Symbols to Sentry'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

Dependencies

"expo": "50.0.7",
"@sentry/react-native": "5.19.1"

Is there anyway to resolve this?

drewbietron avatar Feb 28 '24 16:02 drewbietron

@drewbietron Thank you for the message, this is only a warning, we will fix it soon.

Let us know if your build is failing, as that would be caused by something else.

krystofwoldrich avatar Feb 28 '24 17:02 krystofwoldrich

@krystofwoldrich thanks for the quick reply. This is actually making our builds fail

image

drewbietron avatar Feb 28 '24 17:02 drewbietron

@drewbietron Thank you for the extra logs, can you add export SENTRY_CLI_EXTRA_ARGS="--log-level=debug" to your envs to get more details about the failed request?

https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/#configure-automatic-debug-symbols-upload

This seems to be an example of an issue we recently closed, can you post the new logs there and we can reopen it.

  • https://github.com/getsentry/sentry-react-native/issues/3582

Does it happen only in CI or also when you try the build locally?

krystofwoldrich avatar Feb 28 '24 17:02 krystofwoldrich

@krystofwoldrich It is only happening when building in Expo. When I run the app locally I can send errors to Sentry and see the source.

The xcode logs are actually giving a 401 Invalid org token -- I see the auth token in the logs , but the Sentry dashboard says that the auth token I've generated has never been used + the 401.

+ UPLOAD_DEBUG_FILES='"/Users/expo/workingdir/build/node_modules/@sentry/cli/bin/sentry-cli" debug-files upload --log-level=debug   "/Users/expo/workingdir/build/packages/app/ios/build/Build/Products/Debug-iphonesimulator"'
+ '[' '' '!=' true ']'
+ /bin/sh -c '"node" "/Users/expo/workingdir/build/node_modules/@sentry/cli/bin/sentry-cli" debug-files upload --log-level=debug   "/Users/expo/workingdir/build/packages/app/ios/build/Build/Products/Debug-iphonesimulator"'
  INFO    2024-02-28 10:15:15.446841 -08:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)
  DEBUG   2024-02-28 10:15:15.447062 -08:00 sentry-cli version: 2.25.2, platform: "darwin", architecture: "arm64"
  INFO    2024-02-28 10:15:15.447073 -08:00 sentry-cli was invoked with the following command line: "/Users/expo/workingdir/build/node_modules/@sentry/cli-darwin/bin/sentry-cli" "debug-files" "upload" "--log-level=debug" "/Users/expo/workingdir/build/packages/app/ios/build/Build/Products/Debug-iphonesimulator"
  INFO    2024-02-28 10:15:15.447097 -08:00 Issuing a command for Organization: paintball-vault Project: app-development
  DEBUG   2024-02-28 10:15:15.449013 -08:00 request GET https://sentry.io/api/0/organizations/paintball-vault/chunk-upload/
  DEBUG   2024-02-28 10:15:15.449039 -08:00 using token authentication
  DEBUG   2024-02-28 10:15:15.449055 -08:00 retry number 0, max retries: 0
  DEBUG   2024-02-28 10:15:15.529761 -08:00 > GET /api/0/organizations/paintball-vault/chunk-upload/ HTTP/1.1
  DEBUG   2024-02-28 10:15:15.529782 -08:00 > Host: sentry.io
  DEBUG   2024-02-28 10:15:15.529785 -08:00 > Accept: */*
  DEBUG   2024-02-28 10:15:15.529786 -08:00 > Connection: TE
  DEBUG   2024-02-28 10:15:15.529788 -08:00 > TE: gzip
  DEBUG   2024-02-28 10:15:15.529790 -08:00 > User-Agent: sentry-cli/2.25.2
  DEBUG   2024-02-28 10:15:15.533171 -08:00 > Authorization: Bearer sntrys_e***
  DEBUG   2024-02-28 10:15:15.649165 -08:00 < HTTP/1.1 401 Unauthorized
  DEBUG   2024-02-28 10:15:15.649195 -08:00 < server: nginx
  DEBUG   2024-02-28 10:15:15.649200 -08:00 < date: Wed, 28 Feb 2024 18:15:15 GMT
  DEBUG   2024-02-28 10:15:15.649203 -08:00 < content-type: application/json
  DEBUG   2024-02-28 10:15:15.649206 -08:00 < www-authenticate: xBasic realm="api"
  DEBUG   2024-02-28 10:15:15.649240 -08:00 < allow: GET, POST, HEAD, OPTIONS
  DEBUG   2024-02-28 10:15:15.649254 -08:00 < access-control-allow-methods: GET, POST, HEAD, OPTIONS
  DEBUG   2024-02-28 10:15:15.649263 -08:00 < access-control-allow-headers: X-Sentry-Auth, X-Requested-With, Origin, Accept, Content-Type, Authentication, Authorization, Content-Encoding, sentry-trace, baggage, X-CSRFToken
  DEBUG   2024-02-28 10:15:15.649268 -08:00 < access-control-expose-headers: X-Sentry-Error, X-Sentry-Direct-Hit, X-Hits, X-Max-Hits, Endpoint, Retry-After, Link
  DEBUG   2024-02-28 10:15:15.649281 -08:00 < access-control-allow-origin: *
  DEBUG   2024-02-28 10:15:15.649283 -08:00 < x-sentry-rate-limit-remaining: 39
  DEBUG   2024-02-28 10:15:15.649288 -08:00 < x-sentry-rate-limit-limit: 40
  DEBUG   2024-02-28 10:15:15.649290 -08:00 < x-sentry-rate-limit-reset: 1709144116
  DEBUG   2024-02-28 10:15:15.649292 -08:00 < x-sentry-rate-limit-concurrentremaining: 24
  DEBUG   2024-02-28 10:15:15.649294 -08:00 < x-sentry-rate-limit-concurrentlimit: 25
  DEBUG   2024-02-28 10:15:15.649298 -08:00 < vary: Accept-Language, Cookie
  DEBUG   2024-02-28 10:15:15.649305 -08:00 < content-language: en
  DEBUG   2024-02-28 10:15:15.649308 -08:00 < x-frame-options: deny
  DEBUG   2024-02-28 10:15:15.649311 -08:00 < x-content-type-options: nosniff
  DEBUG   2024-02-28 10:15:15.649313 -08:00 < x-xss-protection: 1; mode=block
  DEBUG   2024-02-28 10:15:15.649318 -08:00 < content-security-policy: img-src * blob: data:; font-src * data:; media-src *; connect-src 'self' *.algolia.net *.algolianet.com *.algolia.io sentry.io *.sentry.io s1.sentry-cdn.com o1.ingest.sentry.io api2.amplitude.com app.pendo.io data.pendo.io reload.getsentry.net t687h3m0nh65.statuspage.io sentry.zendesk.com ekr.zdassets.com maps.googleapis.com; base-uri 'none'; worker-src blob:; default-src 'none'; style-src * 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'report-sample' s1.sentry-cdn.com js.sentry-cdn.com browser.sentry-cdn.com statuspage-production.s3.amazonaws.com static.zdassets.com aui-cdn.atlassian.com connect-cdn.atl-paas.net js.stripe.com 'strict-dynamic' cdn.pendo.io data.pendo.io pendo-io-static.storage.googleapis.com pendo-static-5634074999128064.storage.googleapis.com; frame-src app.pendo.io demo.arcade.software js.stripe.com sentry.io; object-src 'none'; frame-ancestors 'self' *.sentry.io; report-uri https://o1.ingest.sentry.io/api/54785/security/?sentry_key=f724a8a027db45f5b21507e7142ff78e&sentry_release=f83b8301d4aa7e8d208b932d949f7fb2acdb2bbb
  DEBUG   2024-02-28 10:15:15.649333 -08:00 < x-envoy-attempt-count: 1
  DEBUG   2024-02-28 10:15:15.649336 -08:00 < x-envoy-upstream-service-time: 102
  DEBUG   2024-02-28 10:15:15.649338 -08:00 < x-served-by: getsentry-web-rpc-production-578dbf5c4-czqv6
  DEBUG   2024-02-28 10:15:15.649340 -08:00 < x-sentry-proxy-url: http://10.2.0.67:8999/api/0/organizations/paintball-vault/chunk-upload/
  DEBUG   2024-02-28 10:15:15.649343 -08:00 < x-served-by: getsentry-control-web-default-common-production-86bb7479982mmpw
  DEBUG   2024-02-28 10:15:15.649345 -08:00 < x-served-by: frontend-default-55f469fdbb-8h2gt
  DEBUG   2024-02-28 10:15:15.649347 -08:00 < strict-transport-security: max-age=31536000; includeSubDomains; preload
  DEBUG   2024-02-28 10:15:15.649349 -08:00 < via: 1.1 google
  DEBUG   2024-02-28 10:15:15.649351 -08:00 < Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000
  DEBUG   2024-02-28 10:15:15.649353 -08:00 < Transfer-Encoding: chunked
  DEBUG   2024-02-28 10:15:15.652380 -08:00 response status: 401
  DEBUG   2024-02-28 10:15:15.652389 -08:00 body: {"detail":"Invalid org token"}
error: API request failed
  caused by: sentry reported an error: Invalid org token (http status: 401)
  DEBUG   2024-02-28 10:15:15.652499 -08:00 skipping update nagger because session is not attended

drewbietron avatar Feb 28 '24 19:02 drewbietron

@drewbietron Thank you for the log, I checked and see all your tokens were used at least once.

When you check Bundle React Native code and images, where Sentry uploads source maps, is the same token used, does that succeed?

When running the app locally have you tried to build the Release version, using Expo Go the debug files are not uploaded.

You can try running only the upload command to verify the token. https://docs.sentry.io/product/cli/dif/#uploading-files

krystofwoldrich avatar Feb 29 '24 09:02 krystofwoldrich

@krystofwoldrich turns out I had a token set in project secrets and account wide secrets in or Expo account, and the project environment variable was outdated.

Appreciate your response on this, everything works as expected after using the correct token. 🙇

drewbietron avatar Feb 29 '24 14:02 drewbietron

@drewbietron Happy to hear that, everything works now!

krystofwoldrich avatar Feb 29 '24 16:02 krystofwoldrich

I was getting the error message for local builds. What was not obvious to me, is that you need to have the Sentry auth token set locally as well:

In my case, I created a ~/.sentryclirc file, per these instructions: https://docs.sentry.io/product/cli/configuration/#to-authenticate-manually:

[auth]
token={Sentry auth token here}

Note in the instructions, you can also use the sentry-cli to help set the auth token locally.

chrisl777 avatar Mar 06 '24 19:03 chrisl777

@chrisl777 If you only build a Release version of your application in CI, then you don't have to have the token set locally.

If you want to build Release locally without uploading debug files to Sentry you can use export SENTRY_DISABLE_AUTO_UPLOAD=true

https://docs.sentry.io/platforms/react-native/manual-setup/manual-setup/

krystofwoldrich avatar Mar 07 '24 13:03 krystofwoldrich

Maybe this information will help someone as well: in my case i was missing "@sentry/cli" package in my expo react-native project and the error was the same abotu "ambiguos dependencies"...

SmileHub avatar May 02 '24 11:05 SmileHub

Unfortunately, SENTRY_DISABLE_AUTO_UPLOAD=true doesn't work when trying to build locally. I've also tried logging in with sentry-cli, which didn't work either. I'm using: "@sentry/react-native": "~5.20.0". Here's the full error output that I'm getting.

[RUN_FASTLANE] ⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Pods/abseil » Build Phases » 'Create Symlinks to Header Folders'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

[RUN_FASTLANE] ⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Ponder/Ponder » Build Phases » 'Upload Debug Symbols to Sentry'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

[RUN_FASTLANE] ⚠️  Script has ambiguous dependencies causing it to run on every build.
   To fix, go to: Xcode » Ponder/Ponder » Build Phases » '[CP-User] [RNFB] Core Configuration'
   Either: Uncheck "Based on dependency analysis", or select output files to trigger the script

Hi @olddustysocksunderthecouch, SENTRY_DISABLE_AUTO_UPLOAD=true disables the automatic upload, but the build phase still runs as the upload condition is evaluated inside of the build phase. The build phase will run run, but won't require any of the Sentry envs setup.

Script has ambiguous dependencies causing it to run on every build. is a warning and doesn't interfere with your build.

krystofwoldrich avatar May 10 '24 11:05 krystofwoldrich

Hey all! I got this to work. I found that even though I already have the SENTRY_AUTH_TOKEN in my eas.json, I still had to add the SENTRY_AUTH_TOKEN as a secret in Expo's EAS Cloud Dashboard as a secret in order for this to work, so there seems to be an issue with some variables in eas.json not being used in the build proces.

I hope this helps.

zlanich avatar May 12 '24 02:05 zlanich

This has been happening to me today. I have my SENTRY_AUTH_TOKEN set in Expo EAS as I have done for some time now and I push the credentials up from my machine using eas secret push as I always have. I have tested my auth token with a curl request and it is valid. It is also working with eas update. Do you have some kind of active API issue which is causing my iOS builds to fail? Android works fine. I am getting the same error as the above with Multiple commands produce and Script has ambiguous dependencies causing it to run on every build.

I have checked the Sentry status page and all is green. Not really sure what to do from here.

TreeMan360 avatar May 15 '24 10:05 TreeMan360

I eventually found the issue with my build! Hidden in the Xcode Logs output was a problem with the iOS distribution certificates and provisioning profiles. I deleted all of them locally (key chain) and on Apple Developers. I then recreated them with eas credentials, and then the build worked!

I wish the error message had been more obvious and easier to discover! Not finding it made me think poorly of Sentry because its warnings were outputted last in the build output, and I had to hunt through Xcode logs of a local iOS build instead. Weirdly, one of the Cloud eas builds succeeded, and another didn't indicate any issues, even in the Xcode logs. This prompted me to try building it locally (see these docs). You'll also need to set export EAS_LOCAL_BUILD_SKIP_CLEANUP=1 so the logs aren't destroyed after the build completes.

Anyway, I hope this helps some one.

Screenshot 2024-05-15 at 15 42 44

Yeah I found my problem also it was a PrivacyInfo.xcprivacy duplication issue

TreeMan360 avatar May 15 '24 14:05 TreeMan360

@zlanich Could you share how your set the SENTRY_AUTH_TOKEN in eas.json? Possibly this is more of a Expo question, but I might be able to help.

krystofwoldrich avatar May 15 '24 15:05 krystofwoldrich

@olddustysocksunderthecouch Thank you for the update, happy to hear that you find it and that it was not Sentry. I feel with you, the Xcode logs are difficult to navigate.

krystofwoldrich avatar May 15 '24 15:05 krystofwoldrich

Yeah I found my problem also it was a PrivacyInfo.xcprivacy duplication issue

@TreeMan360 Anything we can help with? Or was it unrelated to Sentry?

krystofwoldrich avatar May 15 '24 15:05 krystofwoldrich

I am seeing this warning as well. However, it's not preventing us from building the app. But our main.jsbundle is no longer uploading as a release artifact when running a full expo build, but the source maps are. Not sure if the message and the bundle missing are related..

We recently upgraded to Expo 50 and also did the migration from sentry-expo to the sentry react native package.

avogel3 avatar Jun 27 '24 21:06 avogel3

Hi @avogel3, thank you for the message, the warning message is unrelated.

Could you open a new issue with details about the bundle and the source map? Could you include what do you see in Sentry, it the bundle 0 bytes or missing? Could you include Xcode log from Bundle React Native and images?

krystofwoldrich avatar Jun 28 '24 08:06 krystofwoldrich