question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to execute 'send' on 'XMLHttpRequest', React Native Debugger

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:22 (2 by maintainers)

github_iconTop GitHub Comments

17reactions
airguidecommented, Dec 12, 2017

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

7reactions
xotahalcommented, Feb 13, 2018

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"];
Read more comments on GitHub >

github_iconTop Results From Across the Web

react native - failed to execute 'send' on 'XMLHttpRequest'
I use realm in my project, but when I tried to enable the debugging it shows an error?
Read more >
Networking
Many mobile apps need to load resources from a remote URL. You may want to make a POST request to a REST API,...
Read more >
XMLHttpRequest.send() - Web APIs | MDN
The XMLHttpRequest method send() sends the request to the server. If the request is asynchronous (which is the default), this method returns ...
Read more >
Debugging
You can debug React Native apps using the Chrome debugger tools. Rather than running your app's JavaScript on your phone, it will instead...
Read more >
React Native Debugger: Tips for fast debugging
Leveraging the power of Chrome DevTools, RN Debugger logs most of the fetch and XMLHTTPRequest in the network tab of the developer tool....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found