*I've looked into the other issues related to this error, but this is caused by something different
Using [email protected] I have the following contract function:
pragma solidity ^0.5.2;
contract Versioned {
string[] public data; // when deployed, data already has 1 item
function getVersionIndex() public view returns (uint count) {
return data.length - 1;
}
}
The Web3 code is:
const versionIndex = await contract.getVersionIndex();
// ...
public getVersionIndex(): Promise<any> {
return this.contract.methods.getVersionIndex().call();
}
Contract class already has an address and the method does not require any params.
I've tried adding the { from: "0xadress" }, but it makes no difference.
Return the value of the Solidity data.length as uint count.
As a note, I've debugged the contract using https://remix.ethereum.org/ and the getVersionIndex() function works as expected.
The error is originating at AbiCoder.decodeParameters of web3-eth-abi.umd.js:65:
key: "decodeParameters",
value: function decodeParameters(outputs, bytes) {
if (!bytes || bytes === '0x' || bytes === '0X') {
throw new Error("Invalid bytes string given: ".concat(bytes));
}
Will check this closer asap.
I'm having exactly the same issue. @nivida what clarification do you need?
I'm too facing same issue , Is there any update on this?
Same issue.
Same for me. Works fine after downgrading to [email protected]
I still get it on beta 51
Error: Uncaught (in promise): Error: Invalid bytes string given: 0x
Error: Invalid bytes string given: 0x

Similar issue with beta-58
Error: Invalid bytes string given: undefined
Same for me. Works fine after downgrading to
[email protected]
I think downgrading and upgrading shouldn't be the solution for this problem.
Most helpful comment
Same for me. Works fine after downgrading to
[email protected]