-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow JsonRpcProvider to retry getting its network after instantiation #814
Comments
During that time, can you hit the Geth externally, like using |
@ricmoo yes, I have a service that check geth health and it is healthy once it is backup and all the jsonRPC works. The |
Yeah, I should trap the bad body results (it is returning XML, probably) and throw a server error instead. If you connect a JsonRpcProvider to a node that is down, and do not provide a network, it will currently never work, but that is something I could easily change. Until the feature is added, you can resolve this by passing in a network as the second parameter. But I’ll look into this today. I have a few other things I want to get to today too and this lines up well with them. :) |
@ricmoo passing a Thank you for creating such a well-written eth library! |
Oh, you should be able to pass in just the chain ID for PoA (as a number). Not sure what that is though, but you might know it or it is prolly easy to look up on your node. You can pass in a string (like |
okay ! thanks for the help. |
This should work now in 5.0.0-beta.185. The Provider API was tweaked a bit to better support network discovery in the event it fails when created. |
@ricmoo will try it out ! |
This fix broke JsonRpcProvider for me :( Added a comment to the offending line: |
There's some breakage: ethers-io/ethers.js#814 (comment)
Can you try 5.0.0-beta.186 that was release this afternoon and let me know if you still have any problems? |
There's some breakage: ethers-io/ethers.js#814 (comment)
Closing this now as the above comment link indicates the latest version has fixed the issue. If not, please re-open. Thanks! :) |
(Also, the above issue is referenced in #822) |
There's some breakage: ethers-io/ethers.js#814 (comment)
There's some breakage: ethers-io/ethers.js#814 (comment)
initializing jsonRpcProvider and calling any function before geth is healthy/run will return
could not detect network (code=NETWORK_ERROR, version=providers/5.0.0-beta.164)
this seems to work as expected
but once the geth is backed up, the error still persists.
I tried changing all the call to create a new instance of
jsonRpcProvider
and call the functions instead of initializing once as a singleton as example hereFrom
To
Now it works, once geth is up the server can connect to it without any problem.
also, if the jsonRpc is created after geth is healthy, but geth dies after the error is different
note: this also happen with v4 with different error like
invalid response 0
The text was updated successfully, but these errors were encountered: