-1

I am getting an error in web3js when calling a view only function from one of my solidity smart contracts. Oddly enough it works on a local testnet (run via Ganache) however when I deploy the contracts to the ropsten test network, the fall function fails with the following error:

Uncaught (in promise) Error: Returned values aren't valid, did it run Out of Gas?
    at i.decodeParameters (web3.min.js:22508)
    at l.o._decodeMethodReturn (web3.min.js:29647)
    at A.outputFormatter (web3.min.js:29766)
    at A.formatOutput (web3.min.js:16439)
    at u (web3.min.js:16615)
    at web3.min.js:17813
    at inpage.js:1
    at inpage.js:1
    at i (inpage.js:1)
    at inpage.js:1
    at inpage.js:1
    at c (inpage.js:1)
    at inpage.js:1
    at We (inpage.js:1)
    at Object.<anonymous> (inpage.js:1)
    at e.exports._runReturnHandlersUp (inpage.js:1)
    at inpage.js:1
    at n (inpage.js:1)
    at i (inpage.js:1)
    at inpage.js:1
    at inpage.js:1
    at n (inpage.js:1)
    at i (inpage.js:1)
    at inpage.js:1
    at inpage.js:1
    at inpage.js:1
    at inpage.js:1
    at c (inpage.js:1)
    at u (inpage.js:1)
    at inpage.js:1
    at inpage.js:1
    at a (inpage.js:1)

I also get another error following this stating:

Denying load of chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/sourcemaps/inpage.js.map. Resources must be listed in the web_accessible_resources manifest key in order to be loaded by pages outside the extension.

Which may or may not be related.

My frontend code that is causing the error is:

for (var i = 0; i < userDetails[0]; i++) {
            console.log(i)
            var contractAddress = await trsContract.methods.getUserContract(i).call()
            console.log(contractAddress)
            contractAddresses.push(contractAddress)
        }

I am using the following dependencies

    "@material-ui/core": "^4.5.2",
    "material-ui": "^0.20.2",
    "react": "^16.11.0",
    "react-dom": "^16.11.0",
    "react-router-dom": "^5.1.2",
    "react-scripts": "3.2.0",
    "react-spinners": "^0.6.1",
    "validator": "^12.0.0",
    "web3": "^1.2.2"
TylerH
  • 20,799
  • 66
  • 75
  • 101
Raymond Mogg
  • 192
  • 7
  • Does this answer your question? [Uncaught Error: Returned values aren't valid, did it run Out of Gas?](https://stackoverflow.com/questions/52956509/uncaught-error-returned-values-arent-valid-did-it-run-out-of-gas) – TylerH Dec 30 '22 at 17:22

1 Answers1

0

Did you initiate trsContract with the correct contract address?

It will return an error if you set the wrong address.

StillFantasy
  • 1,677
  • 9
  • 21