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

Upload debug symbols to Sentry step fails when node binary not at /usr/bin/node #3798

Closed
5 tasks done
taylorkline opened this issue May 3, 2024 · 3 comments
Closed
5 tasks done

Comments

@taylorkline
Copy link

OS:

  • MacOS

Platform:

  • iOS

SDK:

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

SDK version:

  - RNSentry (5.22.0):
    - hermes-engine
    - React-Core
    - React-hermes
    - Sentry/HybridSDK (= 8.24.0)

react-native version: 0.73.8

Are you using Expo?

  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)

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

N/A

Configuration:

Bundle React Native Code and Images:

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\""

Upload debug symbols to Sentry:

export SENTRY_PROPERTIES=sentry.properties

[[ $SENTRY_INCLUDE_NATIVE_SOURCES == "true" ]] && INCLUDE_SOURCES_FLAG="--include-sources" || INCLUDE_SOURCES_FLAG=""
SENTRY_CLI="../../../node_modules/@sentry/cli/bin/sentry-cli"
$SENTRY_CLI --log-level=debug debug-files upload "$INCLUDE_SOURCES_FLAG" "$DWARF_DSYM_FOLDER_PATH"

I have the following issue:

The build stage "Upload Debug Symbols to Sentry" fails with

Steps to reproduce:

Install node with something like fnm and configure correctly.

Observe that /usr/bin/env node displays "Welcome to Node.js v...."

Observe that, because of .xcode.env.local, the step "Bundle React Native code and images" succeeds fine and outputs "Node found at:..."

Observe that, because of the shebang in @sentry/cli/bin/sentry-cli, running the script immediately errors with "env: node: No such file or directory".

Observe that when node is symlinked in /usr/local/bin/node, the step succeeds fine.

Actual result:

"Upload Debug Symbols to Sentry" should find and use node just like "Bundle React Native code and images"

Expected result:

"Upload Debug Symbols to Sentry" requires node to be in the default PATH because of the #!/usr/bin/env node shebang

@krystofwoldrich
Copy link
Member

krystofwoldrich commented May 6, 2024

Hi,
thank you for the message, you can replace the Upload Debug Symbols to Sentry shell script with the following code.

/bin/sh ../../scripts/sentry-xcode-debug-files.sh

Let us know if this solution helped you, if not feel free to comment with more details and we can reopen the issue.

@taylorkline
Copy link
Author

Hi, thank you for the message, you can replace the Upload Debug Symbols to Sentry shell script with the following code.

/bin/sh ../../scripts/sentry-xcode-debug-files.sh

Let us know if this solution helped you, if not feel free to comment with more details and we can reopen the issue.

@krystofwoldrich no dice, after changing the command to /bin/sh ../../../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh

+ '[' -z '' ']'
+ WITH_ENVIRONMENT=../node_modules/react-native/scripts/xcode/with-environment.sh
+ '[' -f ../node_modules/react-native/scripts/xcode/with-environment.sh ']'
+ set -e
+ LOCAL_NODE_BINARY=node
+ '[' -z '' ']'
+ export SENTRY_PROPERTIES=sentry.properties
+ SENTRY_PROPERTIES=sentry.properties
+ '[' -z '' ']'
++ node --print 'require('\''path'\'').dirname(require.resolve('\''@sentry/cli/package.json'\''))'
../../../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh: line 22: node: command not found
+ SENTRY_CLI_PACKAGE_PATH=
Command PhaseScriptExecution failed with a nonzero exit code

The "Bundle React Code and Images" step still has no problem.

Node found at: /Users/taylor/node-18
+ LOCAL_NODE_BINARY=/Users/taylor/node-18
+ '[' -z '' ']'

@taylorkline
Copy link
Author

@krystofwoldrich following the way "Bundle React Code and Images" works, I made "Upload Debug Symbols to Sentry" work as follows:

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"

This worked fine. What do you think?

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
Development

No branches or pull requests

2 participants