Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RN 0.76 Regression - jsi::JSError is not visually visible to the end user #47215

Closed
jpudysz opened this issue Oct 26, 2024 · 9 comments
Closed
Labels
0.76 Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Needs: Attention Issues where the author has responded to feedback. Resolution: Fixed A PR that fixes this issue has been merged. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@jpudysz
Copy link

jpudysz commented Oct 26, 2024

Description

I began developing a new version of react-native-unistyles as soon as the RC for 0.75 was released. During this time, I added a lot of JSI code that has been tested dozens of times.

Yesterday, I upgraded my example project from RN 0.75.4 to 0.76.0 and noticed that jsi::JSError is no longer propagated to the Xcode console or shown as a red screen to the user.

I have no information on Android since I haven't created bindings for it yet.

I prepared two reproducers with minimal code, along with screenshots showing results for RN 0.75.4 and 0.76.

Steps to reproduce

  1. Create new Bare RN 0.76 project
  2. Add any native code / library that throws jsi::JSError
  3. An error is thrown, but there is no visual indication to confirm it

For my 0.76 reproducer:

  1. Please go to Pods/Development Pods/Unistyles/cxx/hybridObjects/HybridStyleSheet.cpp
  2. Add breakpoint at line 18
helpers::assertThat(rt, count == 2, "StyleSheet.create expected to be called with one argument.");
  1. Verify that jsi::JSError is thrown

Here is my 0.75.4 reproducer, where everything works fine:
https://github.com/jpudysz/rn-0.75-jsi-reproducer

React Native Version

0.76.0

Affected Platforms

Runtime - iOS

Output of npx react-native info

System:
  OS: macOS 15.0
  CPU: (12) arm64 Apple M3 Pro
  Memory: 728.19 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 20.15.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.7.0
    path: /usr/local/bin/npm
  Watchman:
    version: 2024.06.24.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "23"
      - "28"
      - "29"
      - "30"
      - "33"
      - "34"
      - "35"
    Build Tools:
      - 30.0.3
      - 34.0.0
      - 35.0.0
    System Images:
      - android-23 | ARM 64 v8a
      - android-28 | ARM 64 v8a
      - android-29 | ARM 64 v8a
      - android-30 | ARM 64 v8a
      - android-30 | Google APIs ARM 64 v8a
      - android-34 | Android TV ARM 64 v8a
      - android-34 | ARM 64 v8a
      - android-35 | Google APIs ARM 64 v8a
    Android NDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12483815
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 15.0.0-alpha.2
    wanted: 15.0.0-alpha.2
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.76.0
    wanted: 0.76.0
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: true
iOS:
  hermesEnabled: true
  newArchEnabled: true

Stacktrace or Logs

No crash

Reproducer

https://github.com/jpudysz/rn-0.76-jsi-reproducer

Screenshots and Videos

RN 0.75.4

Simulator Screenshot - iPhone 16 Pro Max - 2024-10-26 at 07 07 41

RN 0.76.0

Simulator Screenshot - iPhone 16 Pro Max - 2024-10-26 at 07 08 56

@react-native-bot react-native-bot added the Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. label Oct 26, 2024
@shubhamguptadream11 shubhamguptadream11 added Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. and removed Needs: Triage 🔍 labels Oct 26, 2024
@cortinico cortinico added the 0.76 label Oct 28, 2024
@cipolleschi cipolleschi added the Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) label Oct 28, 2024
@cipolleschi
Copy link
Contributor

cipolleschi commented Oct 28, 2024

This issue uses NitroModules and the error is thrown when the ReactInstance calls loadScript right at the beginning of the execution.

I would like to have a reproducer with a vanilla React Native, with no NitroModules and a simple C++ module, to be able to understand better what's going on.
As of now, I can't exclude that perhaps NitroModules are not yet compatible with 0.76.

(They also don't build on Android...)

@jpudysz
Copy link
Author

jpudysz commented Oct 28, 2024

Sorry, it was just easier to add my code rather than create it from scratch. I'm experiencing the same behavior with Turbo Modules.

Pushed new commit: https://github.com/jpudysz/rn-0.76-jsi-reproducer

image

Result:

Simulator Screenshot - iPhone 16 Pro Max - 2024-10-28 at 15 51 50

@github-actions github-actions bot added Needs: Attention Issues where the author has responded to feedback. and removed Needs: Author Feedback labels Oct 28, 2024
@cipolleschi
Copy link
Contributor

Thanks for updating the reproducer!

I can verify that if the error happens early, it is not bubbled to the redbox.
Moving the throwing line inside a component, makes it work fine.

I believe that this is because when we throw the error too early, there is no error pipeline ready to catch it.

QQ: when you were trying in 0.75, were you on the new or on the old architecture?

@jpudysz
Copy link
Author

jpudysz commented Oct 29, 2024

Updated RN 0.75.4 repro with the same code: https://github.com/jpudysz/rn-0.75-jsi-reproducer
It also runs New Arch, and I can see the early JSI error:

Simulator Screenshot - iPhone 16 Pro Max - 2024-10-29 at 11 34 26

@cipolleschi
Copy link
Contributor

@jpudysz could you try to apply this patch #47287 and verify that it fixes? I tried it myself, but I'd love to have a double check from you.

@jpudysz
Copy link
Author

jpudysz commented Oct 29, 2024

I can confirm it works as expected! 👏

@cortinico cortinico added the Resolution: PR Submitted A pull request with a fix has been provided. label Oct 29, 2024
@cipolleschi
Copy link
Contributor

We will ship this in 0.76.2. I already created the pick request.

Do we want to close the issue, meanwhile?

@jpudysz
Copy link
Author

jpudysz commented Oct 30, 2024

If you ask me, It should be closed as soon as #47287 is merged

@cortinico
Copy link
Contributor

If you ask me, It should be closed as soon as #47287 is merged

Closing as the PR is merged 👍

@cortinico cortinico added Resolution: Fixed A PR that fixes this issue has been merged. and removed Resolution: PR Submitted A pull request with a fix has been provided. labels Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.76 Impact: Regression Describes a behavior that used to work on a prior release, but stopped working recently. Issue: Author Provided Repro This issue can be reproduced in Snack or an attached project. Needs: Attention Issues where the author has responded to feedback. Resolution: Fixed A PR that fixes this issue has been merged. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

6 participants