You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All issues which aren't created with this template will get immediately closed.
This happens on an Angular 7 project, I am not sure if this issue also affects other frameworks or if it is some combination with the dependencies that Angular pulls.
After some debugging (that was made harder due to zone.js), I found out that when a net::ERR_NAME_NOT_RESOLVED or an net::ERR_CONNECTION_REFUSED error will happen request.onreadystatechange will get called with request.readyState === 4 && request.status === 0.
Since there is no handling of this case the promise will not resolve at all.
Promise should reject when the connection is refused or DNS fails to resolve.
Actual behavior
The promise never resolves/rejects.
Steps to reproduce the behavior
Set an invalid rpc endpoint url on the HttpProvider. It can be either an url of of something that is not an rpc endpoint or and invalid url that dns cannot resolve.
Attempt to get the chain id await this.web3.eth.net.getId();
Error Logs
Versions
[NPM, Node, Web3.js, OS, device...]
npm: '6.4.1'
node: v10.13.0
web3.js: 1.0.0-beta.46
Chrome and Firefox (Linux)
The text was updated successfully, but these errors were encountered:
kelsos
changed the title
HttpProvider promise doens't resolve on invalid RPC endpoint.
HttpProvider promise doesn't resolve on invalid RPC endpoint.
Feb 20, 2019
All issues which aren't created with this template will get immediately closed.
This happens on an Angular 7 project, I am not sure if this issue also affects other frameworks or if it is some combination with the dependencies that Angular pulls.
After some debugging (that was made harder due to zone.js), I found out that when a
net::ERR_NAME_NOT_RESOLVED
or annet::ERR_CONNECTION_REFUSED
error will happenrequest.onreadystatechange
will get called withrequest.readyState === 4
&&request.status === 0
.Since there is no handling of this case the promise will not resolve at all.
https://github.com/ethereum/web3.js/blob/89ee348a9758362e994ef2d8625f8aef46c61b91/packages/web3-providers/src/providers/HttpProvider.js#L142
Expected behavior
Promise should reject when the connection is refused or DNS fails to resolve.
Actual behavior
The promise never resolves/rejects.
Steps to reproduce the behavior
HttpProvider
. It can be either an url of of something that is not an rpc endpoint or and invalid url that dns cannot resolve.await this.web3.eth.net.getId();
Error Logs
Versions
[NPM, Node, Web3.js, OS, device...]
Chrome and Firefox (Linux)
The text was updated successfully, but these errors were encountered: