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
• 27,620 points
52 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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
• 66,910 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
• 27,620 points
79 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 2, 2018 in Blockchain by Shashank
• 10,330 points
47 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 in Blockchain by Omkar
• 66,910 points
31 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
83 views
0 votes
1 answer
+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,620 points
104 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
• 66,910 points
86 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.