3

I'm listening to events of my deployed contract. Whenever a transaction gets completed and event is fired receiving the response causes following error:

Uncaught Error: Returned values aren't valid, did it run Out of Gas? at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeParameters (index.js:227) at ABICoder.push../node_modules/web3-eth-abi/src/index.js.ABICoder.decodeLog (index.js:277)

Web3 version: 1.0.0-beta36

Metamask version: 4.16.0

How do I fix it?

1 Answer 1

7

This is a bug in web3js, discussed here.

And the following change fixes it (source):

patch-package
--- a/node_modules/web3-eth-abi/src/index.js
+++ b/node_modules/web3-eth-abi/src/index.js
@@ -280,7 +280,7 @@ ABICoder.prototype.decodeLog = function (inputs, data, topics) {


     var nonIndexedData = data;
-    var notIndexedParams = (nonIndexedData) ? this.decodeParameters(notIndexedInputs, nonIndexedData) : [];
+    var notIndexedParams = (nonIndexedData && nonIndexedData !== '0x') ? this.decodeParameters(notIndexedInputs, nonIndexedData) : [];

     var returnValue = new Result();
     returnValue.__length__ = 0;

Edit: Downgrading to 1.0.0-beta33 fixes the problem as well.

1
  • updating to latest (v1.2.9) also fixes for me
    – Lee
    Jun 12, 2020 at 10:12

Your Answer

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

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