Realm-js: Chrome debugging fails in RN using Realm

Created on 24 Jun 2016  路  17Comments  路  Source: realm/realm-js

When enabling Chrome Debugging in the React Native app running on a real device, the Chrome Debugging Tab opens and after some seconds, this error appears
debugerror
The app keeps running on the device.
When trying to reload the app, it loads forever (the indicator keeps spinning):
debugerror2
Unlike #491 there are no get_property requests listed in dev tools:
debugerror3

These errors began when I started to use Realm in my app. Everything works fine except for Chrome Debugging.

O-Community T-Bug

All 17 comments

This really looks to me like an issue you're having with React Native, not Realm. Were you able to get this working?

Nope. I've not been using the chrome debugger since then.

I believe I've ran into this before, but I'm still pretty sure it's not caused by Realm. I would try restarting closing the Chrome debugging tab, restarting the packager, and restarting the app.

I restarted everything possible:

  • Chrome debugging tab
  • packager (run npm start again)
  • app
  • deleted the app entirely and run react-native run-android again
  • device

Nothing works.

Would it be possible for you to share your app or an example app that reproduces the issue? You can send it to us privately at [email protected]

I just tried to reproduce it. The steps were pretty simple, so I don't think you really need a whole example app, but let me know if you do:

react-native init example
cd example
npm install --save realm
# make sure, rnpm is installed (`sudo npm install -g rnpm` should do it)
rnpm link realm
react-native run-android
npm start
# Chrome debugging works now

If I add the line import Realm from 'realm'; at the beginning of index.android.js, and reload the app, Chrome debugging stops working as mentioned in my first comment.

The device has Android 5.0.2 and my example had these versions:

"dependencies": {
  "react": "15.1.0",
  "react-native": "0.28.0",
  "realm": "^0.14.1"
}

I could be that port forwarding isn't working. This is supposed to happen automatically but could happen if you have multiple devices. Can you try running these commands to see if they make a difference?

adb reverse tcp:8081 tcp:8081
adb forward tcp:8082 tcp:8082

Weird news: This building's internet connection is broken, so I had to connect through an iPad hotspot. Now the debugger works both in the example app and in my original app.

I'm going to investigate this further, when my internet connection is repaired (within the next 24h), but it seems to be an issue with my wlan infrastructure.

I'm going to try your reverse/forward commands, too.

Now, back in my home wlan, I get the same error as before. I tried your reverse/forward commands, too, but nothing changed.

I have no clue what's causing this. There's nothing custom in my wlan configuration.

I'm not convinced this issue is being caused by Realm. Do you have the same issues with projects not using Realm?

No. The only time, this happens, is when I import realm in a file. See my reproduction steps. That was a clean simple reproduction. Before importing realm, the Chrome Debugger worked, but after importing it didn't work anymore.

But as I said before, it works with an iPad hotspot (both the reproduction app and my original app) but not with my home wlan (with default settings). Let's use some high level logic here:

  • The functioning of the Chrome debugger does depend on the usage of realm, but only when using my home wlan.
  • The functioning of the Chrome debugger does depend on the wlan environment, but only when using realm.
  • The functioning of the Chrome debugger does not depend on specific app details.

Based on this reasoning it seems that realm or my home wlan must be the cause of the issue. Having checked that I'm using default settings in my home wlan, and not having any unusual wlan problems in the last years, my bet is on realm.

Would it make a difference for you if I'd reset my router setting to firmware config? I mean, if that was enough "proof" for you to investigate this, I'd do it, but if it wouldn't change your "investigation motivation", I'll skip that ;)

Don't think resetting the firmware will make much of a difference. The realm debug server runs on the device on port 8082 so if this were for some reason being blocked on your configuration that might explain things? I would like to resolve this but have not yet been able to reproduce the issue. Do you have the same issue when running with genymotion or using android emulator rather than running on device?

I tried it with an android emulator. I had to run adb forward tcp:8082 tcp:8082 to make the Chrome debugger work. So no, no issue there... Would it help if I tried it with genymotion, too?

I think we simply have issues with chrome debug mode when running on device. Hopefully you can debug your app using the emulator/genymotion until we are able to properly support this. In my experience genymotion is much faster/a better dev experience.

same issue
2017

I am closing the issue as we have in v10.x made many changes to our Chrome debugger support.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ashah888 picture ashah888  路  3Comments

emrehayirci picture emrehayirci  路  3Comments

fever324 picture fever324  路  4Comments

bdebout picture bdebout  路  3Comments

jmartindivmedianet picture jmartindivmedianet  路  3Comments