Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error after installing Realm: Must first create RPC session with a valid host

I recently installed realm using:

npm i realm -S
react-native link realm

Important edit This issue only occurs when debugging from device

Everything still works but this time, when I try to enable Debug Js Remotely from the development menu, I get the error Must first create RPC session with a valid host. Remote debugging used to work and the development server is still running on port 8081 as it used to be.

If there is any code example you want, please let me know. Realm is not invoked until later.

From package.json:

{
  "name": "ExampleProject",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node node_modules/react-native/local-cli/cli.js start",
    "test": "jest"
  },
  "dependencies": {
    "babel-jest": "^20.0.1",
    "babel-preset-react-native": "1.9.1",
    "jest": "^20.0.1",
    "react": "16.0.0-alpha.6",
    "react-native": "^0.44.0",
    "react-native-device-detection": "^0.1.3",
    "react-native-elements": "^0.11.2",
    "react-native-orientation": "git+https://github.com/yamill/react-native-orientation.git",
    "react-native-scrollable-tab-view": "^0.6.5",
    "react-native-vector-icons": "^4.1.1",
    "react-navigation": "^1.0.0-beta.9",
    "react-test-renderer": "16.0.0-alpha.6",
    "realm": "^1.3.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

Error:Screenshot

Realm's Issue tracker mentioned it once "somewhere" but I couldn't find a fix. Has anyone seen this message before and can you point me in the right direction to fix this?

like image 778
DerpyNerd Avatar asked May 17 '17 06:05

DerpyNerd


1 Answers

There might be a better answer in the future or not at all. So, here's what I found.

I'm not really sure what solves this issue. At least, make sure that realm's port (8082 by default) is reachable on your device by commanding adb forward tcp:8082 tcp:8082 in a terminal.

Furthermore, make sure the device is connected(!) to the same subnet/network to avoid any packet dropping.

Try completely removing the app from the device (reset) in combination with shutting down the packager and re-running react-native run-android / running from xcode.

I don't believe there is a uniform solution yet at the time of writing.

like image 58
DerpyNerd Avatar answered Nov 20 '22 00:11

DerpyNerd