Closed theJovian closed 3 months ago
Same. I checked it and the Sentry CLI seems to overwrite the $NODE_BINARY env variable. I added a echo $NODE_BINARY
in react-native-xcode.sh and the output shows the sentry cli, not /path/to/node
A workaround for now (at least for me) is, to patch react-native-xcode.sh and replace the env var with the (locally correct) hard-coded node path (i.e. just "node" or "/usr/local/bin/node" or whatever).
Hi @theJovian and @sbeigel,
thank you for the report, the React Native new xcode script is currently not compatible with the sentry stript out of the box. We will fix this soon.
You can use the following workaround, manually set the new React Native config command.
export CONFIG_CMD="$NODE_BINARY $NODE_ARGS $REACT_NATIVE_PATH/cli.js config"
export CONFIG_APP="${CONFIG_CMD}"
We will need to investigate why https://github.com/getsentry/sentry-cli/blob/a2a4d543f4d191db553f7b1b3385c5cd0c9cfefd/src/commands/react_native/xcode.rs#L425 doesn't execute the https://github.com/getsentry/sentry-cli/blob/a2a4d543f4d191db553f7b1b3385c5cd0c9cfefd/src/commands/react_native/xcode.rs#L425 correctly.
I see one more issue with Bundle React Native code and images
patch script. It will not bundle the main.jsbundle
and assets
to the ipa file when archiving, making the app crash on start. Btw, I'm using Sentry with Nx monorepo.
@xuanmai-agilityio Has this change with upgrade to 0.75? And the workaround from https://github.com/getsentry/sentry-react-native/issues/4036#issuecomment-2298451212 doesn't work?
same issue
@krystofwoldrich Do you mean to update the Bundle React Native code and images
like this? Just tried but it didn't work.
Based on this comment: https://github.com/getsentry/sentry-react-native/issues/4036#issuecomment-2298451212
We got something like this and is working for us:
Maybe we are missing $NODE_ARGS though
@xuanmai-agilityio @theJovian Yes, both looks good.
The missing $NODE_ARGS
are okay, unless you are using them yourself, by default they are empty.
I've update the code snippet.
This is now easy copy paste.
export CONFIG_CMD="$NODE_BINARY $NODE_ARGS $REACT_NATIVE_PATH/cli.js config"
export CONFIG_APP="${CONFIG_CMD}"
The snippet will work with the future fix in the RN script.
As well as the Sentry CLI fix.
It didn't work on my end with the fix below. Furthermore, I'm also using the Nx mono repo. Are there any differences in configuring on a mono repo?
@xuanmai-agilityio Do you get any errors?
Would you anticipate this working within a CircleCI environment during build?
Report of this still happening with 5.31.0 (with new arch enabled): https://github.com/getsentry/sentry-react-native/issues/4052
the same error in the linked issue above persists with RN 0.75.2, sentry 5.31.0 with the old architecture built with github actions. safe to say sentry is still not compatible with RN 0.75 right now
2024-08-27T19:12:31.0110520Z + EXTRA_ARGS+=("--config-cmd" "$NODE_BINARY $NODE_ARGS $REACT_NATIVE_DIR/cli.js config")
2024-08-27T19:12:31.0116630Z + /Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/@sentry/cli-darwin/bin/sentry-cli /Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/react-native/scripts/bundle.js --config-cmd '' --entry-file index.js --platform ios --dev false --reset-cache --bundle-output /Users/runner/Library/Developer/Xcode/DerivedData/example-dogmvunyynjjkkhewueaqvycrhvv/Build/Intermediates.noindex/ArchiveIntermediates/APM/BuildProductsPath/Release-iphoneos/main.jsbundle --assets-dest /Users/runner/Library/Developer/Xcode/DerivedData/example-dogmvunyynjjkkhewueaqvycrhvv/Build/Intermediates.noindex/ArchiveIntermediates/APM/BuildProductsPath/Release-iphoneos/AzusaPlayer.app --sourcemap-output /Users/runner/Library/Developer/Xcode/DerivedData/example-dogmvunyynjjkkhewueaqvycrhvv/Build/Intermediates.noindex/ArchiveIntermediates/APM/BuildProductsPath/Release-iphoneos/main.jsbundle.map --minify false --config-cmd '/Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/@sentry/cli-darwin/bin/sentry-cli /Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/react-native/cli.js config'
2024-08-27T19:12:31.0122770Z error: unrecognized subcommand '/Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/react-native/cli.js'
2024-08-27T19:12:31.0123330Z
2024-08-27T19:12:31.0123500Z Usage: sentry-cli [OPTIONS] <COMMAND>
2024-08-27T19:12:31.0123730Z
2024-08-27T19:12:31.0123900Z For more information, try '--help'.
2024-08-27T19:12:31.0124430Z node:internal/errors:984
2024-08-27T19:12:31.0124740Z const err = new Error(message);
2024-08-27T19:12:31.0125030Z ^
2024-08-27T19:12:31.0125170Z
2024-08-27T19:12:31.0126290Z Error: Command failed: /Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/@sentry/cli-darwin/bin/sentry-cli /Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/react-native/cli.js config
2024-08-27T19:12:31.0127840Z error: unrecognized subcommand '/Users/runner/work/azusa-player-mobile/azusa-player-mobile/node_modules/react-native/cli.js'
got the same issue
Got this issue when running with updated Bundle React Native code and images
scripts.
Error: Command failed: /Users/maixuan/Develop/AsNet/AgilityKash/apps/consumer-mobile/ios/Pods/../../node_modules/react-native/cli.js config
env: node: No such file or directory
at checkExecSyncError (node:child_process:890:11)
I'm not a sentry developer, but to me it looks like this issue is fixed by #2131 but this fix is NOT released yet and NEITHER included in @sentry/react-native. So we have to wait for that (and use custom patches until it's released).
@sbeigel that's correct, the fix needs to be released with sentry-cli
and then bumped in @sentry/react-native. We'll update this issue when it becomes available.
@xuanmai-agilityio For monorepos you will need to adjust the path to the react-native
package.
Based on the error you got, something like this should work.
export CONFIG_CMD="$NODE_BINARY $NODE_ARGS ../../../../node_modules/react-native/cli.js config"
export CONFIG_APP="${CONFIG_CMD}"
Fix released in 5.31.1
I am getting still facing an error on 5.31.1.
No bundle URL present.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle.
*** Terminating app due to uncaught exception 'RCTFatalException: No bundle URL present.
Make sure you're running a packager server or have included a .jsbundle file in your application bundle.', reason: 'No bundle URL present.
These are my project versions (I'm not using expo):
"@sentry/react-native": "^5.31.1",
"react": "18.3.1",
"react-native": "0.75.1"
These are the content from Bundle React Native code and Images (auto-generated):
set -e
WITH_ENVIRONMENT="$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh"
REACT_NATIVE_XCODE="$REACT_NATIVE_PATH/scripts/react-native-xcode.sh"
/bin/sh -c "$WITH_ENVIRONMENT \"\"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\"\""
and these are in Upload Debug Symbols to Sentry (also auto-generated):
/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode-debug-files.sh
The issue doesn't exist if I remove Sentry. Is this related to the parent issue? or any work arounds?
@Asad520
It seems to work with pnpm monorepo + React Native 0.75.2 + sentry 5.31.1.
Not finding the above jsbundle seems to be a different issue!
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"
/bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\""
How about trying the above?
@jieey1140 The script you provided worked for me. Thank you! 🥳
Still getting this issue:
"react-native": "^0.75.2",
"@sentry/react-native": "^5.31.1",
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"
/bin/sh -c "$WITH_ENVIRONMENT \"/bin/sh ../node_modules/@sentry/react-native/scripts/sentry-xcode.sh $REACT_NATIVE_XCODE\""
▸ Running script 'Bundle React Native code and images'
❌ error: sentry-cli - 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
❌ error: sentry-cli - INFO 2024-09-07 22:48:57.253587 -07:00 Loaded file referenced by SENTRY_PROPERTIES (sentry.properties)
❌ error: unrecognized subcommand '/Users/christopherfinch/Projects/KeyhiveIoPhoneApp/node_modules/react-native/cli.js'
❌ error: unrecognized subcommand '/Users/christopherfinch/Projects/KeyhiveIoPhoneApp/node_modules/react-native/cli.js'
I've now wasted many hours trying to debug. My next step is removing sentry altogether.
Please advise.
cc @krystofwoldrich
Hi @chrisfinch,
I'm sorry to hear that.
If you are running in the auto upload issue, you can always use SENTRY_DISABLE_AUTO_UPLOAD=true
, to build the application without the auto source maps upload and then run the comman manually https://docs.sentry.io/platforms/react-native/sourcemaps/
Based on the output, the sentry-xcode.sh
is still using the old version of sentry-cli
.
The script uses the Node JS resolution to get the binary require.resolve('@sentry/cli/package.json')
possibly you have multiple version of the Sentry CLI installed.
You can try to run node --print "require('path').dirname(require.resolve('@sentry/cli/package.json'))"
in the RN project root to check the path resolves. You can also use SENTRY_CLI_EXECUTABLE
env to manually select the path or install the sentry-cli@latest
JS package manually.
OS:
Platform:
SDK:
@sentry/react-native
(>= 1.0.0)react-native-sentry
(<= 0.43.2)SDK version: 5.30.0
react-native
version: 0.75.1Are you using Expo?
Are you using sentry.io or on-premise?
If you are using sentry.io, please post a link to your issue so we can take a look: N/A
Configuration:
(
@sentry/react-native
)I have the following issue:
The following error appears when building for ios in release
Steps to reproduce:
Actual result:
Build fails
Expected result:
Build succeeds