truffle-hdwallet-provider icon indicating copy to clipboard operation
truffle-hdwallet-provider copied to clipboard

Error: Invalid JSON RPC response: ""

Open StarNeit opened this issue 7 years ago • 13 comments

Error: Invalid JSON RPC response: "" 4|bwcoin_p | at Object.InvalidResponse (/var/www/xxx/node_modules/truffle-hdwallet-provider/node_modules/web3/lib/web3/errors.js:35:16) 4|bwcoin_p | at XMLHttpRequest.request.onreadystatechange (/var/www/xxx/node_modules/truffle-hdwallet-provider/node_modules/web3/lib/web3/httpprovider.js:115:32) 4|bwcoin_p | at XMLHttpRequestEventTarget.dispatchEvent (/var/www/bwcoin/node_modules/xhr2/lib/xhr2.js:64:18) 4|bwcoin_p | at XMLHttpRequest._setReadyState (/var/www/bwcoin/node_modules/xhr2/lib/xhr2.js:354:12) 4|bwcoin_p | at XMLHttpRequest._onHttpResponseEnd (/var/www/bwcoin/node_modules/xhr2/lib/xhr2.js:509:12) 4|bwcoin_p | at IncomingMessage. (/var/www/bwcoin/node_modules/xhr2/lib/xhr2.js:469:24) 4|bwcoin_p | at emitNone (events.js:91:20) 4|bwcoin_p | at IncomingMessage.emit (events.js:185:7) 4|bwcoin_p | at endReadableNT (_stream_readable.js:974:12) 4|bwcoin_p | at _combinedTickCallback (internal/process/next_tick.js:80:11) 4|bwcoin_p | at process._tickDomainCallback (internal/process/next_tick.js:128:9) 4|bwcoin_p | [nodemon] app crashed - waiting for file changes before starting...

I am minting tokens using hdwallet-provider and infura, but i am receiving this issue. How can I avoid this interruption?

StarNeit avatar Feb 17 '18 09:02 StarNeit

I solved this problem by correcting the url set in HDWalletProvider in truffle.js file. If any one of HDWalletProvider has wrong url, the error occurs. I hope this works for you too.

seitau avatar Mar 05 '18 09:03 seitau

will infura endpoint expire ? how to verify if the infura link is still valid

rayeaster avatar Mar 07 '18 04:03 rayeaster

got same problems, seems not the issue about truffle.js urls. Any clue?

rayeaster avatar Mar 07 '18 07:03 rayeaster

I was getting this error too, and it seemed to be because the eth node was not available via the url I provided.

At the end of the HDWalletProvider constructor:

this.engine.start(); // Required by the provider engine.

https://github.com/trufflesuite/truffle-hdwallet-provider/blob/master/index.js#L46

This kicks of some polling via setInterval where it starts polling for blocks and actually connecting to the blockchain. Its here that the problem seemed to occur.

Not to sound to critical of the authors of this fantastic project, but I don't think its not a good practice to be kicking off async stuff like this in a constructor.

It'd be nice if the pattern was more like:

const walletProvider = new HDWalletProvider...
walletProvider.testConnnection() // or some way to check it where Errors can actually be caught
walletProvider.startPolling()

zachlysobey avatar Apr 28 '18 17:04 zachlysobey

Getting this issue all the time. Using Infura, node, no truffle. Seems a timeout issue. Impossible to catch :(

GarryPlays avatar May 07 '18 21:05 GarryPlays

@zachlysobey Hello, i just wonder, why they need to start pooling at all? for example, if i just using infura url as provider for web3, web3 will send request to enfura when i will ask for it, getBalance, or deploy smart contract etc. And i will not receive this error.

Spaider15 avatar May 18 '18 08:05 Spaider15

Faced the same issue. Getting this error when trying to run the write function on Ropsten-Infura testnet. Can anyone please suggest some solution to this. Its urgent. Thanks in advance. Read Functions are running fine.

gianchandania avatar Jun 01 '18 05:06 gianchandania

anyone found the solution yet? I use truffle with kovan infura

haidoan avatar Aug 22 '18 17:08 haidoan

catch crash, retry .. I know, it's that sad

On Wed, Aug 22, 2018 at 7:04 PM haidoan [email protected] wrote:

anyone found the solution yet? I use truffle with kovan infura

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/trufflesuite/truffle-hdwallet-provider/issues/14#issuecomment-415105256, or mute the thread https://github.com/notifications/unsubscribe-auth/AeC1eAnIKEHXOhIcfEfmkCSql-m52ndZks5uTY8ogaJpZM4SJP7r .

GarryPlays avatar Aug 22 '18 18:08 GarryPlays

Gonna see if I can dig into the providers and stop the polling

highruned avatar Oct 18 '18 03:10 highruned

Any update on this

theone3nu avatar Apr 28 '19 22:04 theone3nu

If anyone wants to stop polling, use hdWalletProvider.engine.stop()

nneverlander avatar May 30 '19 07:05 nneverlander

Make sure the link/URL to the blockchain you are sending messages too is valid as well. That was my issue. Once I corrected it, it worked. (I had the wrong Infura security token)

mlekena avatar Sep 03 '19 17:09 mlekena