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'

See original GitHub issue

hi, while trying to work with remote debugging (#562 and #571) i upgraded to rn 0.32 and now i’m seeing this when enabling the remote debugging:

Failed to execute 'send' on 'XMLHttpRequest': Failed to load 'http://192.168.1.178:8082/create_session'.

i understand there’s some issues with remote debugging. the ip address is the ip of the android device

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:18
  • Comments:28 (4 by maintainers)

github_iconTop GitHub Comments

25reactions
Selman555commented, Jul 11, 2017

My guess is as follows. Running on a device and debugging fails because normally adb forward tcp:8082 tcp:8082 takes care of the correct redirection from device to host. Because you are debugging from chrome http://<ip-address>:8082/create_session is an invalid url.

I changed the following lines in node_modules/realm/lib/browser/rpc.js

// The global __debug__ object is provided by Visual Studio Code.
if (global.__debug__) {
    let request = global.__debug__.require('sync-request');
    let response = request('POST', url, {
      body: JSON.stringify(data),
      headers: {
        "Content-Type": "text/plain;charset=UTF-8"
      }
    });

    statusCode = response.statusCode;
    responseText = response.body.toString('utf-8');
} else {
    let body = JSON.stringify(data);
    let request = new XMLHttpRequest();

    request.open('POST', url, false);
    request.send(body);

    statusCode = request.status;
    responseText = request.responseText;
}

to

// The global __debug__ object is provided by Visual Studio Code.
if (global.__debug__) {
    let request = global.__debug__.require('sync-request');
    let response = request('POST', url, {
      body: JSON.stringify(data),
      headers: {
        "Content-Type": "text/plain;charset=UTF-8"
      }
    });

    statusCode = response.statusCode;
    responseText = response.body.toString('utf-8');
} else {
    let body = JSON.stringify(data);
    let request = new XMLHttpRequest();

    // ALWAYS POINT TO LOCALHOST
    if (__DEV__) {
        url = 'http://localhost:8082' + url.substring(url.lastIndexOf('/'));
    }

    request.open('POST', url, false);
    request.send(body);

    statusCode = request.status;
    responseText = request.responseText;
}

And now everything works fine (even when not debugging remotely) I hope this helps

15reactions
L3V147H4Ncommented, Sep 11, 2016

react-native link realm doesn’t fix this issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

NetworkError: Failed to execute 'send' on 'XMLHttpRequest'
I had this problem literally a few minutes ago. The problem is that you need to set async:false to async:true .
Read more >
Error: Failed to execute 'send' on 'XMLHttpRequest' #126
I do know that when the browser gives you such a vague message ("Failed to execute 'send'") instead of a more specific HTTP...
Read more >
Failed to execute 'send' on 'XMLHttpRequest' - IT Handyman
Once again I came across a strange issue on one of our client's websites. Their website is being placed in the iFrame on...
Read more >
Failed to load '/api/portal/setlogouttimer': Synchronous XHR in ...
DRZNZ-14007 Error : Failed to execute 'send' on 'XMLHttpRequest': Failed to load '/api/portal/setlogouttimer': Synchronous XHR in page dismissal. Summary.
Read more >
NetworkError : Failed to execute 'send' on XMLHttpRequest'
NetworkError : Failed to execute ' send' on XMLHttpRequest ':Follow Instagram ...
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