realm-js: Unable to debug the app in Chrome, getting error : I Realm : Starting the debugging WebServer, Host: null Port: 8082 (adb logcat error)

Hi I m unable to debug my app which has realm db, I see a white screen with nothing else, and also when I hit reload on the emulator, I m getting the following error while debugging in chrome console :

Running application "realm_mobile" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF

POST http://localhost:8082/get_property:1 POST http://localhost:8082/get_property net::ERR_EMPTY_RESPONSE

POST http://localhost:8082/create_realm:1 POST http://localhost:8082/create_realm net::ERR_EMPTY_RESPONSE

Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://localhost:8082/create_realm.

When the debugger is removed, the code runs as its expected. I have checked the other issues raised with similar behaviour issue-276. I have tried manually port reverse & forward

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

I see the following error in adb logcat - I Realm : Starting the debugging WebServer, Host: null Port: 8082

I am using the following react(15.0.2), react-native(0.26.1), realm(0.13.0) versions. Is this supported ? Any help here from the logs attached and errors above would be appreciated.

Update : I have tried this on my android device also with same result. Without debugger, things work fine but once debugger is attached we get the white screen

Edit 1: Can you please look at this issue as it is blocking us badly. Thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 8
  • Comments: 24 (6 by maintainers)

Most upvoted comments

Greetings, I have a working implementation for Android.

Versions

  • OS: OSX 10.12.3 (16D32)
  • React Native: 0.48.4
  • Realm: 1.12.0 + Port update patch

Steps

  1. Add a postinstall script to your package.json:
... 
"postinstall": "bash ./scripts/patch_realm_port.sh",
...
  1. Add the project/scripts directory && touch patch_realm_port.sh

patch_realm_port.sh

#!/bin/bash

# android
perl -0777 -i -pe 's/(?mi-s)(private static final int DEFAULT_PORT = 8082;)/ private static final int DEFAULT_PORT = 8083;/g' "./node_modules/realm/android/src/main/java/io/realm/react/RealmReactModule.java"

# ios
perl -0777 -i -pe 's/(?mi-s)(#define WEB_SERVER_PORT 8082)/#define WEB_SERVER_PORT 8083/g' "./node_modules/realm/android/src/main/java/io/realm/react/RealmReactModule.java"
  1. Run yarn install on your root dir

  2. Build android release

  3. IMPORTANT: run the following adb commands

  • adb reverse tcp:8081 tcp:8081
  • adb forward tcp:8082 tcp:8082
  • adb forward tcp:8083 tcp:8083
  1. Start node server

  2. Launch android debugger & run

For me running the following commands fixed it, thanks to @TGPSKI’s suggestion:

  • adb reverse tcp:8081 tcp:8081
  • adb forward tcp:8082 tcp:8082
  • adb forward tcp:8083 tcp:8083

I have this on the IOS Simulator. Seemed to kind of “just started happening”. Worked ok before. And now, I can’t get past it.

I’m 0.14.3

screen shot 2016-09-05 at 12 56 47

Thanks @TGPSKI. Your steps worked for me on Windows 10 for android. I changed

DEFAULT_PORT to 8083 in RealmReactModule.java WEB_SERVER_PORT to 8083 in RealmReact.mm

Then I used adb to set up the ports: adb reverse tcp:8081 tcp:8081 adb forward tcp:8082 tcp:8082 adb forward tcp:8083 tcp:8083

followed by

gradlew clean (to do a clean build) and react-native run-android

My environment is

"react": "16.0.0",
"react-native": "^0.49.0",
"realm": "^1.12.0",

I tried adb forward/reverse 8081/8082, no luck. I also tried reversing to an older project snapshot, same problem. Have been getting this. Tried uninstalling via adb and reinstalling again, nothing worked. screen shot 2016-09-06 at 3 22 34 pm

Unfortunately I think chrome debugging is completely broken on device for the time being and I think you are right that some work needs to be done to fix this. Hopefully in the meantime you can debug using an emulator or genymotion.