Web3.js: Web3 1.0.0-beta.38 TypeError: Invalid attempt to spread non-iterable instance

Created on 27 Jan 2019  路  5Comments  路  Source: ChainSafe/web3.js

Getting below error when calling myContract.methods.myMethod().call()

TypeError: Invalid attempt to spread non-iterable instance

This this was working fine in previous beta versions 37, 36 etc. When I upgraded to beta.38 I started getting above error.

bug

Most helpful comment

@nivida This seems to be working fine now. Thanks for providing quick fix.

All 5 comments

I've tested it on my local environment and couldn't replicate this issue. Could you please use the issue template and provide all the information.

I got same trouble, too.
my contract methods using openzeppelin-solidity(v2.1.2) failed even if contract.methods.totalSupply().call().
my enviroment is here.

Truffle v5.0.2 (core: 5.0.2)
Solidity v0.5.0 (solc-js)
Node v10.14.2
solc: Version: 0.5.2+commit.1df8f40c.Darwin.appleclang

Tested it again and got the same error. It was because of the deep cloning of the arguments. (fixed in #2232)

@nivida This seems to be working fine now. Thanks for providing quick fix.

I am getting the same error in this function:

const balanceOf = (application, web3, address) => {
  return application.contract.methods.balanceOf(address).call()
    .then(balance => {
      console.log(`[TOKEN] Balance of '${address}' is ${balance}.`);
      return { balance };
    });
};
Was this page helpful?
0 / 5 - 0 ratings

Related issues

gabmontes picture gabmontes  路  3Comments

praveengupta0895 picture praveengupta0895  路  3Comments

sundbry picture sundbry  路  3Comments

webersson picture webersson  路  3Comments

FradSer picture FradSer  路  3Comments