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

fix(xcode): Upload Debug Symbols continues when node not found #3573

Merged
merged 2 commits into from Feb 5, 2024

Conversation

krystofwoldrich
Copy link
Member

📢 Type of change

  • Bugfix

📜 Description

RN script WITH_ENVIRONMENT calls NODE_BINARY=$(command -v node) which return non-zero when the command doesn't exist. We have -e to exit after the first error, which causes the debug symbols to stop uploading.

This PR enables -e after loading WITH_ENVIRONMENT so no errors in the env stop debug symbols upload.

💡 Motivation and Context

💚 How did you test it?

sample app

📝 Checklist

  • I reviewed submitted code
  • I added tests to verify changes
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled
  • All tests passing
  • No breaking changes

🔮 Next steps

Copy link
Contributor

github-actions bot commented Feb 1, 2024

Android (legacy) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 420.04 ms 440.61 ms 20.57 ms
Size 17.73 MiB 19.85 MiB 2.11 MiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
728164b 414.34 ms 449.22 ms 34.88 ms
34aba08 328.10 ms 342.84 ms 14.74 ms
b1e8712 462.11 ms 465.71 ms 3.60 ms
e73f4ed+dirty 332.96 ms 354.33 ms 21.37 ms
9433f35 347.64 ms 356.22 ms 8.58 ms
457e29f 398.10 ms 421.39 ms 23.29 ms
86d6d2c+dirty 332.90 ms 352.45 ms 19.55 ms
3853f43 329.68 ms 346.32 ms 16.64 ms
2534337 394.15 ms 415.12 ms 20.97 ms
3ffcddd 302.92 ms 315.80 ms 12.88 ms

App size

Revision Plain With Sentry Diff
728164b 17.73 MiB 19.85 MiB 2.12 MiB
34aba08 17.73 MiB 19.80 MiB 2.07 MiB
b1e8712 17.73 MiB 19.75 MiB 2.02 MiB
e73f4ed+dirty 17.73 MiB 20.04 MiB 2.31 MiB
9433f35 17.73 MiB 19.81 MiB 2.08 MiB
457e29f 17.73 MiB 19.84 MiB 2.10 MiB
86d6d2c+dirty 17.73 MiB 20.04 MiB 2.31 MiB
3853f43 17.73 MiB 19.81 MiB 2.08 MiB
2534337 17.73 MiB 19.84 MiB 2.11 MiB
3ffcddd 17.73 MiB 19.75 MiB 2.02 MiB

Copy link
Contributor

@brustolin brustolin left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

github-actions bot commented Feb 1, 2024

Android (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 359.70 ms 415.63 ms 55.93 ms
Size 7.15 MiB 8.12 MiB 991.49 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
5446992+dirty 371.61 ms 390.00 ms 18.39 ms
728164b+dirty 335.93 ms 342.94 ms 7.01 ms
1d86dd6+dirty 335.76 ms 371.22 ms 35.46 ms
e73f4ed+dirty 262.98 ms 311.02 ms 48.04 ms
ad6c299+dirty 336.47 ms 362.89 ms 26.42 ms
9433f35+dirty 265.50 ms 336.08 ms 70.58 ms
457e29f+dirty 591.49 ms 612.96 ms 21.47 ms
86d6d2c+dirty 267.21 ms 325.24 ms 58.04 ms
12427f4+dirty 379.48 ms 400.92 ms 21.44 ms
abb7058+dirty 320.78 ms 324.08 ms 3.30 ms

App size

Revision Plain With Sentry Diff
5446992+dirty 7.15 MiB 8.12 MiB 999.45 KiB
728164b+dirty 7.15 MiB 8.12 MiB 997.71 KiB
1d86dd6+dirty 7.15 MiB 8.13 MiB 1002.18 KiB
e73f4ed+dirty 7.15 MiB 8.09 MiB 965.94 KiB
ad6c299+dirty 7.15 MiB 8.04 MiB 912.17 KiB
9433f35+dirty 7.15 MiB 8.08 MiB 959.34 KiB
457e29f+dirty 7.15 MiB 8.10 MiB 981.29 KiB
86d6d2c+dirty 7.15 MiB 8.09 MiB 962.69 KiB
12427f4+dirty 7.15 MiB 8.12 MiB 997.78 KiB
abb7058+dirty 7.15 MiB 8.10 MiB 980.40 KiB

Copy link
Contributor

github-actions bot commented Feb 1, 2024

iOS (new) Performance metrics 🚀

  Plain With Sentry Diff
Startup time 1205.98 ms 1209.41 ms 3.43 ms
Size 2.92 MiB 3.44 MiB 531.50 KiB

Baseline results on branch: main

Startup times

Revision Plain With Sentry Diff
9433f35+dirty 1232.24 ms 1232.74 ms 0.50 ms
9c48b2c+dirty 1253.39 ms 1256.30 ms 2.91 ms
1d86dd6+dirty 1289.25 ms 1293.36 ms 4.11 ms
d361d38+dirty 1272.96 ms 1291.70 ms 18.74 ms
12427f4+dirty 1224.90 ms 1231.40 ms 6.50 ms
6e8584e+dirty 1271.71 ms 1281.26 ms 9.55 ms
3ffcddd+dirty 1272.22 ms 1273.98 ms 1.76 ms
22e31b6+dirty 1276.55 ms 1278.12 ms 1.57 ms
0677344+dirty 1252.52 ms 1254.08 ms 1.56 ms
3853f43+dirty 1271.74 ms 1278.04 ms 6.30 ms

App size

Revision Plain With Sentry Diff
9433f35+dirty 2.92 MiB 3.41 MiB 503.55 KiB
9c48b2c+dirty 2.92 MiB 3.41 MiB 499.97 KiB
1d86dd6+dirty 2.92 MiB 3.44 MiB 538.27 KiB
d361d38+dirty 2.92 MiB 3.41 MiB 503.57 KiB
12427f4+dirty 2.92 MiB 3.44 MiB 533.29 KiB
6e8584e+dirty 2.92 MiB 3.44 MiB 536.52 KiB
3ffcddd+dirty 2.92 MiB 3.40 MiB 494.39 KiB
22e31b6+dirty 2.92 MiB 3.43 MiB 524.74 KiB
0677344+dirty 2.92 MiB 3.41 MiB 500.94 KiB
3853f43+dirty 2.92 MiB 3.41 MiB 503.54 KiB

@jahead
Copy link

jahead commented Feb 1, 2024

EDIT2: Okay, nvm. I see how moving -e helps this issue. I applied your patch and it fixes it for me too. Ignore the vomit below....


TLDR: While not stopping on error will fix the issue, the with-environment.sh isn't working as intended inside sentry-xcode-debug-files.sh and only seems to work when used in the phase.


@krystofwoldrich while this would probably fix the issue listed here

I was hit with this with newest changes.

My log is returning

+ '[' -z '' ']'
+ WITH_ENVIRONMENT=../node_modules/react-native/scripts/xcode/with-environment.sh
+ '[' -f ../node_modules/react-native/scripts/xcode/with-environment.sh ']'
+ . ../node_modules/react-native/scripts/xcode/with-environment.sh
+++ command -v node
++ NODE_BINARY=

when i use the standard upload debug symbols phase.

If I use the phase I used to solve the issue in #3472

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"

/bin/sh -c "$WITH_ENVIRONMENT ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh"

I get

Node found at: /Users/jahead/.nvm/versions/node/v18.16.1/bin/node
+ '[' -z '' ']'
+ WITH_ENVIRONMENT=../node_modules/react-native/scripts/xcode/with-environment.sh
+ '[' -f ../node_modules/react-native/scripts/xcode/with-environment.sh ']'
+ . ../node_modules/react-native/scripts/xcode/with-environment.sh
+++ command -v node
++ NODE_BINARY=

Obviously, my change shouldn't be required, but I just wanted to illiterate that for some reason sentry-xcode-debug-files.sh isn't loading the .xcode.env.local properly, where if you invoke /bin/sh -c "$WITH_ENVIRONMENT inside the phase it will successfully find the .env.

for context react native will create a .xcode.env.local file that is set to my nvm setting

export NODE_BINARY=/Users/jahead/.nvm/versions/node/v18.16.1/bin/node

so while this fix will silently crash, the real issue is that in sentry-xcode-debug-files.sh WITH_ENVIRONMENT should be loading the .xcode.env.local correctly


EDIT: As In #3472 if I have my phase as

Upload Debug Symbols to Sentry

WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"

/bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh\""

NOTE: I just made the structure of this be same as Bundle React Native code and images but if either this one or the one list #3472 works.

I modified sentry-xcode-debug-files.sh

-[ -z "$WITH_ENVIRONMENT" ] && WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
-
-if [ -f "$WITH_ENVIRONMENT" ]; then
-  # load envs if loader file exists (since rn 0.68)
-  . "$WITH_ENVIRONMENT"
-fi

And sentry-xcode-debug-files.sh is able to find and use node. I do not have default node in my shell.

@krystofwoldrich
Copy link
Member Author

@jahead Happy to read that it helps!

@krystofwoldrich krystofwoldrich merged commit 87d53fd into main Feb 5, 2024
48 of 50 checks passed
@krystofwoldrich krystofwoldrich deleted the kw-fix-with-environment-debug-files branch February 5, 2024 08:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[IOS] Upload Debug Symbols to Sentry failed on build
3 participants