sentry-react-native: 5.18.0 fails to build with jsbundle not found
OS:
- Windows
- MacOS
- Linux
Platform:
- iOS
- Android
SDK:
-
@sentry/react-native
(>= 1.0.0) -
react-native-sentry
(<= 0.43.2)
SDK version: 5.18.0
Are you using Expo?
- Yes
- No
Are you using sentry.io or on-premise?
- sentry.io (SaaS)
- on-premise
Configuration:
(@sentry/react-native
)
Sentry.init({
dsn: 'https://...@sentry.io/...',
environment: "...",
enabled: ...,
});
I have the following issue:
Updating from 5.5.0 to 5.18.0. We wanted to have auto debug ids and source map upload, which we didn’t have up to now. However, the integration of Sentry in the Bundle React Native code and images
build phase fails. This is the build phase script:
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\""
The scripts fails with the following error:
File /Users/X/Library/Developer/Xcode/DerivedData/X-hdkvdafrogcrgmbszvdfcnyhxsrv/Build/Products/Development-iphonesimulator/X.app/main.jsbundle does not exist. This must be a bug with React Native, please report it here: https://github.com/facebook/react-native/issues
There seems to be something off with the way Sentry executes the react native xcode script. Note that the build succeeds if BUNDLE_REACT_NATIVE
is changed to ignore Sentry:
- BUNDLE_REACT_NATIVE="/bin/sh $SENTRY_XCODE $REACT_NATIVE_XCODE"
+ BUNDLE_REACT_NATIVE="/bin/sh $REACT_NATIVE_XCODE"
That way the bundle is being generated, but no sourcemaps in the above mentioned path. Yes, we could add SOURCEMAP_FILE
so that react native generates sourcemaps, but we would have to upload and match source maps manually to sentry.
Using react native 0.71.7
Actual result:
Expected the app to build successfully and Sentry uploading source maps to sentry.io
NOTE: Android works without any problems. App builds and uploads source maps/debug id via gradle.
About this issue
- Original URL
- State: closed
- Created 5 months ago
- Reactions: 2
- Comments: 18 (9 by maintainers)
sorry for the delay. here are the logs:
I should also mention that the app is managed in a monorepo setup. The app is at the following location:
/Users/y/workspace/some-monorepo/some-subfolder/some-app/index.js
. It sayserror The resource /Users/y/workspace/some-monorepo/index.js was not found
which refers to the monorepo root and not the app root. I suppose it should be something like/Users/y/workspace/some-monorepo/some-subfolder/some-app/index.js
Also note that I changed actual names and altered the logs for that matter.
I believe my issue was related to this one: https://github.com/facebook/react-native/issues/41844. I had schemes with spaces in the name (i.e., “MyApp Testing”, “MyApp Staging”) which was causing bundler issues. I was experimenting with different fixes for that which were in turn causing the error I reported above. I ended up just renaming my schemes to remove the spaces and everything was resolved.
@krystofwoldrich here are the logs with generated source maps:
Also note: After some experimenting, everything (including source maps and debug ids) works with this script:
But this uses the “old” sentry cli instead of the “new” sentry react native script
@krystofwoldrich yes, will try that tomorrow.
By the way, we did not use the wizard to set up sentry but did it manually. We had sentry already installed and needed to migrate to a higher version.
@tarasfo I haven’t manually fix the script, I just reinstalled sentry with
npx @sentry/wizard@3.20.3 -s -i reactNative
and it worksHi, Looking at the logs, the issue is with generating the source maps.
Can you enable source maps without Sentry, to verify if that is the case?
Seems like the latest @sentry/wizard (3.20.4) modifies PBXShellScriptBuildPhase shellScript in a wrong way. Version 3.20.3 makes it in the right way. after 3.20.4 install:
after 3.20.3 install:
@proohit Thank you for the long, we will look thought them and keep you posted.
and for reference, this is the build logs without sentry: