Skip to content
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

Unhandled Rejections #1084

Closed
Jonas121 opened this issue Oct 5, 2020 · 4 comments
Closed

Unhandled Rejections #1084

Jonas121 opened this issue Oct 5, 2020 · 4 comments
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.

Comments

@Jonas121
Copy link

Jonas121 commented Oct 5, 2020

hi,

I use ethers in a webpack package, which is running server side application.
Node version 11.15.0
"@babel/core": "^7.11.6",
"@babel/plugin-transform-runtime": "^7.11.5",
"@babel/preset-env": "^7.11.5",
"@babel/preset-react": "^7.10.4",
"babel-loader": "^8.1.0",
"ethers": "^5.0.12",
"express": "^4.17.1",
"webpack": "^4.44.1",
"webpack-cli": "^3.3.12",
"webpack-dev-server": "^3.11.0",
"webpack-node-externals": "^2.5.2"

I use strategy to include provider once per application:
var provider = new ethers.getDefaultProvider('ropsten', {infura: 'keyhere'});

I do simple step only in my application:
let filter ={
...
}
let log1 = await provider.getLogs(filter);

Code is working, provider always return data. But often application crash with an error below. What an issue could be?

Unhandled Rejection at: Promise {
{ Error: failed response (requestBody="{"method":"eth_blockNumber","params":[],"id":45,"jsonrpc":"2.0"}", requestMethod="POST", url="https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVf*********9EkC", code=SERVER_ERROR, version=web/5.0.7)
at Logger.makeError (/home/testuser/rr1/node_modules/@ethersproject/logger/lib/index.js:179:21)
at Logger.throwError (/home/testuser/rr1/node_modules/@ethersproject/logger/lib/index.js:188:20)
at /home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:280:59
at step (/home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:33:23)
at Object.next (/home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:14:53)
at fulfilled (/home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:5:58)
reason: 'failed response',
code: 'SERVER_ERROR',
requestBody:
'{"method":"eth_blockNumber","params":[],"id":45,"jsonrpc":"2.0"}',
requestMethod: 'POST',
url:
'https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVf*********9EkC' } } reason: { Error: failed response (requestBody="{"method":"eth_blockNumber","params":[],"id":45,"jsonrpc":"2.0"}", requestMethod="POST", url="https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVf*********9EkC", code=SERVER_ERROR, version=web/5.0.7)
at Logger.makeError (/home/testuser/rr1/node_modules/@ethersproject/logger/lib/index.js:179:21)
at Logger.throwError (/home/testuser/rr1/node_modules/@ethersproject/logger/lib/index.js:188:20)
at /home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:280:59
at step (/home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:33:23)
at Object.next (/home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:14:53)
at fulfilled (/home/testuser/rr1/node_modules/@ethersproject/web/lib/index.js:5:58)
reason: 'failed response',
code: 'SERVER_ERROR',
requestBody:
'{"method":"eth_blockNumber","params":[],"id":45,"jsonrpc":"2.0"}',
requestMethod: 'POST',
url:
'https://eth-ropsten.alchemyapi.io/v2/_gg7wSSi0KMBsdKnGVf*********9EkC' }

@ricmoo
Copy link
Member

ricmoo commented Oct 5, 2020

A few scripts have been using the ethers default keys recently, bumping me from 4M to 20M calls per day to Alchemy and the other backends.

Does this actually cause your app to crash? Or just muddy up the logs? The application should continue working, I would think?

I am working on this now in a few directions:

  • Adding further client-side throttling (should help limit the handful of people hammering my keys and help nudge them to get their own)
  • Figuring out where this wayward promise is an adding a .catch to it; since the FallbackProvider will automatically fail-over
  • Adding custom keys for the test suite, which is currently un-able to run so I can't publish new versions
  • Rotating keys once things are ready

@ricmoo ricmoo added discussion Questions, feedback and general information. on-deck This Enhancement or Bug is currently being worked on. investigate Under investigation and may be a bug. labels Oct 5, 2020
@ricmoo ricmoo added bug Verified to be an issue. and removed discussion Questions, feedback and general information. investigate Under investigation and may be a bug. labels Jan 13, 2021
@ricmoo
Copy link
Member

ricmoo commented Jan 13, 2021

I do believe this is the same problem as #1208. Please see that issue for updates. :)

@ricmoo
Copy link
Member

ricmoo commented Jan 14, 2021

This should be addressed in 5.0.26. Please try it out and let me know. :)

@ricmoo ricmoo added fixed/complete This Bug is fixed or Enhancement is complete and published. and removed on-deck This Enhancement or Bug is currently being worked on. labels Jan 15, 2021
@ricmoo
Copy link
Member

ricmoo commented Jan 19, 2021

Closing this now, as I think the problem has been resolved. If not, please re-open.

Thanks! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified to be an issue. fixed/complete This Bug is fixed or Enhancement is complete and published.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants