sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

sentry-cli react-native xcode not passing arguments to build script

Open btoueg opened this issue 9 years ago • 9 comments

Issuing the command:

sentry-cli react-native xcode ../node_modules/react-native/packager/react-native-xcode.sh

does not fit my use case because I need to pass an argument to react-native-xcode.sh (the ENTRY_FILE)

I've tried both:

sentry-cli react-native xcode ../[...]/react-native-xcode.sh ./path/to/my/entry/file.js
sentry-cli react-native xcode "../[...]/react-native-xcode.sh ./path/to/my/entry/file.js"

Neither of them is working.

My work around is to manually edit react-native-xcode.sh to hard code ENTRY_FILE, which is quite tedious and I'm prone to forget fixing it after each yarn install

btoueg avatar Jun 14 '17 18:06 btoueg

The reason we let you provide a different build script is precisely to support that. So you could do this:

  1. make a file named mybuild.sh
  2. add these contents:
../node_modules/react-native/packager/react-native-xcode.sh ./path/to/my/entry/file.js
  1. then use sentry-cli react-native-excode mybuild.sh

Does this work for you?

mitsuhiko avatar Jun 16 '17 21:06 mitsuhiko

Closing this due to inactivity.

mitsuhiko avatar Jul 17 '17 17:07 mitsuhiko

I faced the same issue and tried @mitsuhiko solution and it's working now!! Thanks lot!

previously i can get it work on sentry/cli: 1.29.1 using ../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh index.js

but after i upgrade to sentry/cli: 1.31.0, its keep prompting this error

error: Found argument 'index.js' which wasn't expected, or isn't valid in this context
USAGE:
    sentry-cli react-native xcode [OPTIONS] [BUILD_SCRIPT] [-- <ARGS>...]

and after tried your method it works!

anniewey avatar May 17 '18 09:05 anniewey

@mitsuhiko Hi, I am facing the same issue, and I tried your solution, but now xcode returns me the error Permission denied (os error 13) when trying to run the custom shell script 'Bundle react native code and images'. Do you have any idea why ? My custom script 'bundle_code.sh' is located at the root of my project Thanks for your help !

AlexUzan avatar Jul 09 '19 15:07 AlexUzan

changing

../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh ./index.js

to

../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh -- ./index.js

seemed to work for me... at least it built the app...

noway avatar Nov 26 '19 10:11 noway

@mitsuhiko I haven't been able to get this working - details here. Is there a concrete example anywhere of exactly where to put the script and how to reference it?

I'm getting: Permission denied (os error 13)

lukewlms avatar Sep 18 '20 17:09 lukewlms

I ended up removing the Sentry build step, because it isn't designed to work with bitcode, which iOS projects will have on by default.

It seems a bit strange that the default Sentry setup would be incompatible with the majority of iOS installations.

lukewlms avatar Sep 21 '20 16:09 lukewlms

@mitsuhiko I haven't been able to get this working - details here. Is there a concrete example anywhere of exactly where to put the script and how to reference it?

I'm getting: Permission denied (os error 13)

I was able to make it build with chmod 755 rnbuild.sh

my xCode bundle command

cd $PROJECT_DIR/..
export SENTRY_PROPERTIES=ios/sentry.properties
export NODE_BINARY=node
./node_modules/@sentry/cli/bin/sentry-cli react-native xcode ./ios/rnbuild.sh

fdobre avatar Sep 29 '20 16:09 fdobre

../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ../node_modules/react-native/scripts/react-native-xcode.sh -- ./index.js

seemed to work for me... at least it built the app...

THIS!! This fixed it for me. I am building with react native so instead of making a .sh file I went into my /ios/project.pbxproj file and modified the shellScript string under Bundle React Native code and images. I did a CMD+F and looked for "index.js" and was able to easily find the script.

I then set the path to my index.js file which was in my root. So the path was index.ts and I just changed it to -- ./index.ts

Alexandria avatar Jan 19 '22 02:01 Alexandria