I get the error TypeError: XMLHttpRequest is not a function when I try to connect to a node on the server side of my meteor application.

The error is caused by meteor using the meteor HTTP package instead of XMLHttpRequest. From this question.

How else can a meteor app connect to an ethereum node from the server side?

  • Did you find a solution for this problem? I have the same issue.
    – Bumblebee
    Commented Jun 27, 2017 at 17:32
  • @Bumblebee no im still trying
    – Joe
    Commented Jun 28, 2017 at 8:52
  • Meteor uses a different http module docs.meteor.com/api/http.html and here is an issue on we3js #579
    – niksmac
    Commented Jul 3, 2017 at 12:35
  • @niksmac could you explain a bit further- what do I need to do to get it working?
    – Joe
    Commented Jul 3, 2017 at 12:38
  • Simply put, its not a web3 related issue. If you can use the web3 js outside the scope of Meteor; it might work, idk. Never used Meteor.
    – niksmac
    Commented Jul 3, 2017 at 12:43

1 Answer 1


I had the same problem and finally found the solution. I followed this guide and it worked.


Web3 has to be decleared like this:

var Web3 = require('web3');

and then you can create an instance of Web3 like this:

if (typeof web3 !== 'undefined') {
    web3 = new Web3(web3.currentProvider);
} else {
    web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));        

I hope this helps

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.