bugsnag / bugsnag-js-performance

Monitor the performance of your JavaScript (web and React Native) and see the results in your BugSnag dashboard.
https://docs.bugsnag.com/performance/integration-guides
MIT License
4 stars 1 forks source link

Android build fails when using latest RN (0.74) #451

Closed gunti96 closed 2 weeks ago

gunti96 commented 1 month ago

Describe the bug

  1. Just upgraded the project to latest react native version (RN 0.74.1)
  2. iOS is okay, but the android build fails with the following error:
    error Failed to install the app. Command failed with exit code 1: ./gradlew app:installAlphaDebug -PreactNativeDevServerPort=8081
    /path/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js:62 .parseSync(); ^ TypeError: yargs.option(...).option(...).parseSync is not a function at Object.<anonymous> (/path/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js:62:4) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12) at node:internal/main/run_main_module:28:49 Node.js v21.1.0 FAILURE: Build failed with an exception. * What went wrong:
    Execution failed for task ':bugsnag_react-native-performance:generateCodegenSchemaFromJavaScript'.
  3. The project uses many libraries, but if I uninstall just the @bugsnag/react-native-performance package, the build works successfully.

Steps to reproduce

  1. Create a bare RN 0.74.1 project
  2. npm install --save @bugsnag/react-native-performance react-native-file-access @react-native-community/netinfo
  3. Try to generate an android build

Environment

clr182 commented 1 month ago

Hi @gunti96

Can you please confirm whether you have enabled the new architecture option for React-Native 74?

At present we are seeing issues with this configuration due to changes introduced that alter the native bridge between the JS layer and Android layer when the new architecture option is enabled. We are investigating this issue and will be sure to keep you informed of any updates.

gunti96 commented 1 month ago

Hi @clr182 , thanks for your response. I can confirm that the new architecture is not enabled for this project.

mclack commented 1 month ago

Hi @gunti96

Thanks for your patience here.

After looking through this issue again, I believe there's a chance this is being caused by using an outdated version of the BugSnag React Native SDK. You mention using v7.22.3, but support for RN 73 was added in v7.22.4. As you do not have the new architecture enabled and have recently upgraded, I'd assume this is the issue.

Can you confirm whether you were using a RN version below 73 prior to this upgrade? Are you able to upgrade to a newer version of @bugsnag/react-native and let us know whether this fixes the issue?

gunti96 commented 4 weeks ago

Hi @mclack

Thanks for your response. Just tried with the latest versions:

    "@bugsnag/react-native": "^7.23.0",
    "@bugsnag/react-native-performance": "^2.6.0",

and unfortunately similar error is thrown for the android build:

/path/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js:62
  .parseSync();
   ^

TypeError: yargs.option(...).option(...).parseSync is not a function
    at Object.<anonymous> (/path/node_modules/@react-native/codegen/lib/cli/combine/combine-js-to-schema-cli.js:62:4)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v21.1.0

As mentioned above, if I just uninstall the performance library then the build succeeds

mclack commented 3 weeks ago

Hi @gunti96

Thanks for sharing that with us.

We've added a task to our backlog to investigate this issue further. We'll make sure to post any updates on this thread.

yousif-bugsnag commented 2 weeks ago

Hi @gunti96,

We haven't been able to reproduce this on a fresh 0.74 project, either on old or new architecture.

It seems like this is an issue with codegen and yargs, and not just related to BugSnag - please see https://github.com/expo/expo/issues/28494#issuecomment-2081770811

yousif-bugsnag commented 2 weeks ago

I'm going to close this as I don't think it's an issue with @bugsnag/react-native-performance - but if the linked solution above doesn't work and you're able to provide a reproduction example then we'd be happy to reopen and try to investigate further.

gunti96 commented 1 week ago

Hi @yousif-bugsnag, It seems that the linked solution doesn't work after a fresh install, but will try to investigate more in-depth and maybe provide an example if possible.

EDIT: It seems to work by also installing yargs into the project using npm i -D yargs. Thanks for your patience!