web3.js icon indicating copy to clipboard operation
web3.js copied to clipboard

Unhandled rejection Error: Wrong response id "25"

Open hrishikeshio opened this issue 9 years ago • 17 comments

Version 1.0 (commit hash = c154988 )

Many of the examples given in documentation don't work and give this error. here's an example. The response id keeps increasing. Os: mac os x Browser: latest Chrome

web3.eth.accounts.signTransaction({
    to: '0xF0109fC8DF283027b6285cc889F5aA624EaC1F55',
    value: '1000000000',
    gas: 2000000
}, '0x4c0883a69102937d6231471b5dbb6204fe5129617082792ae468d01a3f362318')
.then(console.log);

i {_bitField: 0, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _promise0: undefined, _receiver0: undefined…}
web3-1.0.min.js:1 Unhandled rejection Error: Wrong response id "25" (expected: "3823692783358944") in {"jsonrpc":"2.0","id":3823692783358944,"method":"net_version","params":[]}
    at http://localhost/stateChannel/js/web3-1.0.min.js:1:431701
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:168:7
    at chrome-extension://nkbihfbeogaeaoehlefnkodbefgpgknn/scripts/inpage.js:8222:5
From previous event:
    at i.d [as _captureStackTrace] (http://localhost/stateChannel/js/web3-1.0.min.js:1:362390)
    at i._resolveFromExecutor (http://localhost/stateChannel/js/web3-1.0.min.js:1:395366)
    at new i (http://localhost/stateChannel/js/web3-1.0.min.js:1:387897)
    at e.exports (http://localhost/stateChannel/js/web3-1.0.min.js:1:429178)
    at s.i [as getId] (http://localhost/stateChannel/js/web3-1.0.min.js:1:350837)
    at m.signTransaction (http://localhost/stateChannel/js/web3-1.0.min.js:1:657911)
    at <anonymous>:1:19

hrishikeshio avatar Jul 24 '17 09:07 hrishikeshio

I cannot reproduce this. To which node are you connecting?

Works for me: screen shot 2017-07-24 at 19 21 52

frozeman avatar Jul 24 '17 17:07 frozeman

Using metamask - rinkeby testnet (which i think is infura) I did not compile by the way. Using precompiled web3.min.js in the repo. @frozeman Edit: compiled myself and used web3.js getting same error.

hrishikeshio avatar Jul 25 '17 02:07 hrishikeshio

@kumavis are you altering the response IDs in any way?

frozeman avatar Jul 26 '17 13:07 frozeman

@frozeman No. I dont really know what these are.. can you explain?

hrishikeshio avatar Jul 27 '17 05:07 hrishikeshio

Every JSON rpc request contains a id which needs to come back with the same ID, so the calling library can match requests and responses. It looks like meta mask is changing the returning ID. (i guess at least)

frozeman avatar Jul 27 '17 13:07 frozeman

+1

urbannn avatar Aug 01 '17 17:08 urbannn

@hrishikeshio Did you fix this problem ? I have the same issue and I am stuck

subramanianv avatar Aug 14 '17 05:08 subramanianv

@frozeman i got the same error while upgrading from metamask own web3 to one included by me to fix some deprecation warnings. maybe we have to reset some data somewhere in order to make the nonces restart from 1?

phra avatar Aug 16 '17 11:08 phra

any news about this?

rmi7 avatar Sep 03 '17 19:09 rmi7

I was currently on holidays. The person who could help with that the best would be @kumavis

frozeman avatar Sep 03 '17 19:09 frozeman

coming from #981 since it was closed. some of us have been seeing this error:

MetamaskInpageProvider - sendAsync not overwritten

it seems the problem lies within this.web3.eth.getAccounts

the majority of the time, this function never returns a callback, and when it does, it always causes the Async error. Is this a web3 1.0 issue?

apologies for my formatting, I'm a noob at commenting :(

JamesKnippel avatar Sep 07 '17 02:09 JamesKnippel

it seems to be fixed, have a look at https://github.com/MetaMask/metamask-extension/issues/1940

phra avatar Sep 07 '17 09:09 phra

Please drop a comment if this isn't solved.

nivida avatar Aug 09 '18 12:08 nivida

I encountered this problem suddenly. But I could run the code before.(I didn't change them). So I thought it might be a tempory bug in metaMask and then I just logged out the metamask account and logged in again. It turned right. May be it's helpful for you.

JoshuaQYH avatar Dec 31 '18 03:12 JoshuaQYH

I still encounter this error. Switching accounts in metamask fixes the issue but do we have another fix or workaround for this? It's terrible UX to ask users to do this for a dapp to work.

eccentricexit avatar Mar 18 '19 15:03 eccentricexit

I met the same issue when I try to get status of public mapping variable from bscscan.com. Did anyone solve this issue?

sbwengineer avatar Mar 19 '22 08:03 sbwengineer

你好!你的邮件我已收到!

JoshuaQYH avatar Mar 19 '22 08:03 JoshuaQYH