TypeError XMLHttpRequest is not a function when using web3 on meteor server side

0 votes

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

web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))

var cocontract = web3.eth.contract(abi).at(address);
var name = (cocontract.name())

The error is raised with the 3rd line. If I run the same code on the client side I don't get a problem.

Oct 10, 2018 in Blockchain by digger
• 26,740 points
1,094 views

1 answer to this question.

0 votes

I had the same problem. Instead ethereum:web3 Meteor package I have used web3@0.20.1 NPM package, and it works ok (Meteor version 1.5.1). So, if you using ethereum:web3 you probably need to run:

meteor remove ethereum:web3
meteor npm install web3@0.20.1 --save

and replace

import { Web3 } from 'meteor/ethereum:web3';

with

import Web3 from 'web3';
answered Oct 10, 2018 by Omkar
• 69,220 points

Related Questions In Blockchain

0 votes
1 answer

Error using EtherJS: this.provider.getTransactionCount is not a function

With this line it should work fine: wallet.provider ...READ MORE

answered Sep 26, 2018 in Blockchain by digger
• 26,740 points
2,569 views
0 votes
1 answer

How can we decrypt a transaction payload when confidentiality is on?

You can try the following: you can only ...READ MORE

answered May 3, 2018 in Blockchain by Shashank
• 10,400 points
851 views
0 votes
1 answer
0 votes
1 answer

Truffle dev says my function is not a function

It seems you are using truffle v5. ...READ MORE

answered Jan 24, 2019 in Blockchain by Omkar
• 69,220 points
2,255 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,942 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,468 views
+3 votes
2 answers

How to run ethereumjs using Node.JS

You need to install testrpc globally on ...READ MORE

answered Mar 27, 2018 in Blockchain by ned_crew
• 1,610 points
1,461 views
0 votes
1 answer
0 votes
1 answer

Ethereum "truffle server" gives error: TypeError: fsevents is not a constructor

Looks like you have files missing.  Try creating project with: truffle ...READ MORE

answered Nov 30, 2018 in Blockchain by Omkar
• 69,220 points
956 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP