OS:
Platform:
SDK:
SDK version: 5.1.0
react-native version: 0.71.4
Are you using Expo?
Are you using sentry.io or on-premise?
Configuration:
I used the default configuration from Sentry Wizard.
I have following issue:
When Sentry modifies the "Bundle React Native code and images" in the Xcode project, Xcode fails to build because Sentry's CLI modifies cwd in the RN's build script and sets it to the root of a monorepo. Furthermore, RN's CLI fails to load metro.config.js from the package in a monorepo because cwd is getting resolved to the root of a NX monorepo when the default script resolves a package's path correctly.
Consider following structure in a NX monorepo:
- packages
- mobile (react-native app)
- lib1 (react native shared lib)
When the default build script is used, then the path in logs of the phase is <root>/packages/mobile. However, when I use the Sentry's build script, Sentry's CLI sets the path to <root>.
NX creates a symlinked node_modules folder from the root in the React Native's package, e.g. packages/mobile/node_modules. Presumably, Sentry's CLI incorrectly resolves the symlinked path.
Steps to reproduce:
- Clone the repo
- Install dependencies (yarn was used)
- Verify that the RN's script resolves the metro.config.js path correctly using the command
yarn nx run test:start. It will launch the packager and you'll see the config loaded line, which is a console.log statement in the packages/test/metro.config.js.
- Build the xcode project. I was using Archive and the Release scheme. When build fails, open the build log and notice that there isn't the
config loaded line.
Modifying the RN's CLI module could also help to debug. I logged in console ctx.root in order to get the resolved path.
Actual result:
Path is set to <root>
Expected result:
Path should be set to <root>/packages/mobile.
OS:
Platform:
SDK:
@sentry/react-native(>= 1.0.0)react-native-sentry(<= 0.43.2)SDK version: 5.1.0
react-nativeversion: 0.71.4Are you using Expo?
Are you using sentry.io or on-premise?
Configuration:
I used the default configuration from Sentry Wizard.
I have following issue:
When Sentry modifies the "Bundle React Native code and images" in the Xcode project, Xcode fails to build because Sentry's CLI modifies cwd in the RN's build script and sets it to the root of a monorepo. Furthermore, RN's CLI fails to load metro.config.js from the package in a monorepo because cwd is getting resolved to the root of a NX monorepo when the default script resolves a package's path correctly.
Consider following structure in a NX monorepo:
When the default build script is used, then the path in logs of the phase is
<root>/packages/mobile. However, when I use the Sentry's build script, Sentry's CLI sets the path to<root>.NX creates a symlinked node_modules folder from the root in the React Native's package, e.g.
packages/mobile/node_modules. Presumably, Sentry's CLI incorrectly resolves the symlinked path.Steps to reproduce:
yarn nx run test:start. It will launch the packager and you'll see theconfig loadedline, which is a console.log statement in thepackages/test/metro.config.js.config loadedline.Modifying the RN's CLI module could also help to debug. I logged in console
ctx.rootin order to get the resolved path.Actual result:
Path is set to
<root>Expected result:
Path should be set to
<root>/packages/mobile.