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

Impossible to debug on Android with JSC under new version of Realm? #4364

Closed
liamjones opened this issue Feb 19, 2022 · 11 comments
Closed

Impossible to debug on Android with JSC under new version of Realm? #4364

liamjones opened this issue Feb 19, 2022 · 11 comments
Labels
hermes Bugs and features related to running on the React Native hermes engine O-Community

Comments

@liamjones
Copy link

liamjones commented Feb 19, 2022

Description

When using an Android emulator/device, if you attempt to connect to the Chrome Debugger you now get the following error message:

Error: This version of Realm JS doesn't support the legacy Chrome Debugger. Please use Flipper instead.

This makes sense if your RN app is using hermes but it's misleading if it's still on JSC as you can't use the Hermes debugger in Flipper (and I don't believe there's a JSC debugger in Flipper?)

Does this mean debugging a Realm app on Android is going to become impossible when the Hermes branch releases? For iOS, the Safari debugger is a substitute that can still be used (though isn't ideal as you lose things like the Redux Debugger which is present in the Chrome Debugger based React Native Debugger).

This is probably going to be a blocker for us upgrading Realm if the situation is still the same once the Hermes release becomes the main one. We can't risk losing the ability to debug our entire app on Android because of this (in advance of us being able to shift the app to Hermes).

Stacktrace & log output

No response

Can you reproduce a bug?

Yes, always

Reproduction Steps

No response

Version

10.20.0-beta.1

What SDK flavour are you using?

Local Database only

Are you using encryption?

No, not using encryption

Platform OS and version(s)

N/A

@liamjones liamjones added the hermes Bugs and features related to running on the React Native hermes engine label Feb 19, 2022
@kraenhansen
Copy link
Member

@liamjones I suggest we move our conversation from #4363 into this issue as it seems more on topic for that.

I thought that, eventually, the hermes branch would merge to the mainline and be the only available release for Realm in future

You're right. I'll share an update on this issue as we get more clarity on when this will happen.

Our ultimate goal is to move our apps to Hermes on both platforms but, in our case, it's not as simple as just switching the engine flag.

This is good news - as we do share the React Native teams vision for a future with Hermes being default.


As per your questions on this issue.

I don't believe there's a JSC debugger in Flipper?

I believe you're right and I don't know if the React Native team has any plans on adding this.
I doubt they want to spend more energy in that direction.

Does this mean debugging a Realm app on Android is going to become impossible when the Hermes branch releases?

Right: Once the Hermes branch becomes our "latest" release, you'd have to pin your Realm JS version to be able to debug on Android when running your app with Hermes disabled.

For context

Our legacy Chrome debugger support was tightly coupled with the JavaScriptCore APIs and wasn't using the JS engine abstraction that all our other code was using. Hence, this proved to be difficult to migrate in our efforts to target JSI. Historically our support for the legacy Chrome debugger has been less than ideal - it's been notoriously slow and its maintenance has been actively slowing us down as we've been adding new features over the years. Over all we believe the future of React Native with Hermes and a proper debugging experience through Flipper is very bright and we can't wait to finally say goodbye to our (and hopefully the entire community's) support for the legacy Chrome debugger.


I suggest keeping this issue open to document the lack of support of the legacy Chrome debugger and the caveat:

Releases off our hermes branch (our 10.20.0 pre releases) does not support the legacy Chrome debugging experience and as such there is no known way of debugging JavaScript code when running on Android with Hermes disabled (and JSC enabled). If having this support is important, we suggest you pin your version of Realm JS and postpone upgrading until a point in time when you're ready to make the shift to Hermes and the new / improved debugging experience through Flipper.

@liamjones
Copy link
Author

Thanks for clarifying @kraenhansen. Yep, I totally understand the situation the Realm devs are coming from and why JSC support is being phased out.

I thought that, eventually, the hermes branch would merge to the mainline and be the only available release for Realm in future

You're right. I'll share an update on this issue as we get more clarity on when this will happen.

Thanks, that'll be helpful for work prioritisation here.

@Gnadhi
Copy link

Gnadhi commented Aug 14, 2022

Is there any updates on this ?

@kneth
Copy link
Contributor

kneth commented Aug 15, 2022

@Gnadhi We strongly recommend to try Hermes, Flipper and Realm JS v11.0.0.rc-1 or later. We do not plan to work on the Chrome debugger integration.

@jbarriosenvase
Copy link

@Gnadhi We strongly recommend to try Hermes, Flipper and Realm JS v11.0.0.rc-1 or later. We do not plan to work on the Chrome debugger integration.

Does this means that as long as we use realm, we can forget about proper debugging with any kind of IDE/Editor debugger since they all still work with Chrome JS debugging? And we're gonna have to stick with flipper without being able to make any kind of debugging with Breakpoints?

@kneth
Copy link
Contributor

kneth commented Oct 20, 2022

We have released v11.0.0 with support of Hermes. You might need to add Flipper to your Android app manually: https://fbflipper.com/docs/getting-started/react-native-android/

@sync-by-unito sync-by-unito bot closed this as completed Oct 20, 2022
@liamjones
Copy link
Author

@kraenhansen @kneth FYI there's an RFC raised where the RN team is planning on migrating back to Chrome dev tools being the default for debugging in future again to improve the dev debugging experience. I'm mentioning it in case your team wants to input to the RFC re anything Realm specific: react-native-community/discussions-and-proposals#641

@kraenhansen
Copy link
Member

kraenhansen commented May 10, 2023

@liamjones thanks for sharing this! Reading the document, I see that the proposal will still use the Chrome DevTools Protocol (CDP) and therefore JS code will still be executing on device. I.e. I would say it's incorrect to read this as the "RN team is planning on migrating back to Chrome dev tools" as their proposal is not to revert back to executing JS code in the browser.

From my understanding of the proposal, any app using Realm should be compatible with the proposed debugging experience, although we might see less adoption of our realm-flipper-plugin in the future.

@liamjones
Copy link
Author

Ah sorry, didn't mean to mislead. I hadn't had time to read the RFC in detail yet. Good to hear it shouldn't affect Realm. :)

@kraenhansen
Copy link
Member

kraenhansen commented May 11, 2023

@liamjones no worries. Although we try to engage with the community and stay on top of these things ourselves, it was really good that you brought it to our attention 👍

@kalyncoose
Copy link

Working Flipper Solution (as of Dec 7 2023)

For those who are distraught about not being able to use Redux DevTools because of Realm:

  • I created a Gist on how to install/configure Realm and Redux Debugger Flipper Plugins working for a RN project here: https://gist.github.com/kalyncoose/0d3fd640fc0c3b1e0174959003a8e911
  • This solution provides more advanced examples such as setting up RealmPlugin when you have a RealmProvider and RealmContext as well as setting up Redux Debugger via RTK's configureStore() API.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
hermes Bugs and features related to running on the React Native hermes engine O-Community
Projects
None yet
Development

No branches or pull requests

6 participants