realm-js: Failed to execute 'send' on 'XMLHttpRequest', React Native Debugger

wx20170527-113423

wx20170527-113652

{
    "react": "16.0.0-alpha.6",
    "react-native": "^0.44.0",
    "realm": "^1.3.1",
     ...
}

When i debugger on Android,I’ve this error. But debugger on iOS Simulator. It’s working.

Please hope

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 22 (2 by maintainers)

Most upvoted comments

This may sound dumb but it worked for me: You have to make sure you’re on the same network on the real device and the computer

It seems they just switched from localhost to actual ip address. See https://github.com/facebook/react-native/pull/17720/files

Just temporary solution!

So I’ve changed: https://github.com/realm/realm-js/blob/master/react-native/ios/RealmReact/RealmReact.mm#L124 Instead of:

#if TARGET_IPHONE_SIMULATOR
    NSArray *hosts = @[@"localhost"];
#else
    NSArray *hosts = [self getIPAddresses];
#endif

I used this:

NSArray *hosts = [self getIPAddresses];

And in here: https://github.com/realm/realm-js/blob/master/react-native/ios/RealmReact/RealmReact.mm#L250 Instead of this:

[response setValue:@"http://localhost:8081" forAdditionalHeader:@"Access-Control-Allow-Origin"];

I used this:

[response setValue:@"http://192.168.x.x:8081" forAdditionalHeader:@"Access-Control-Allow-Origin"];

@jcharlet It seems you are using two different versions of adb. Can you check you don’t have android tools on two places on your system with different versions

Hi guys,

I had the same issue and these are the steps that I followed to resolve it.

  • adb forward tcp:8082 tcp:8082
  • adb forward --list (check if your device/emulator is in the list)
  • close or detach usb cable if you have more than one device/emulator opened (in my case I had one emulator and one physical device plugged in) - in short ONLY keep one device open
  • uninstall the app and re-install and start debugging as normally

Hope this helps someone

I’m receiving the same issue for no apparent reason because it was working before.

The adb forwarding checks out:

adb forward --list
0215393942364341 tcp:8082 tcp:8082

adb devices -l
0215393942364341       device usb:336592896X product:zenltexx model:SM_G928F device:zenlte

I tried all above solution but none of them worked for please any one works properly please let me know

This may sound dumb but it worked for me: You have to make sure you’re on the same network on the real device and the computer

Wow really, this works somehow. It ain’t dumb if it’s worked. 😉

Thanks for sharing, saved me time.

None of the solutions above has worked for me… Tried to forward with adb, tried to edit code, nothing helped.

I’m not even using the whole platform, just the React Native database. No sync options whatsoever. Why is this create_session being called?

Thanks @xotahal, this helped me to fix the issue on IOS device.

Actually I have used only the second suggestion: but instead of http://192.168.x.x:8081 I have put there the host of my up and running debugger which had 'http://192.168.x.x.xip.io:8081' strange format.