question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unhandled promise rejections en masse

See original GitHub issue

We’re seeing a ton of unhandled promise rejections using ethers 5.0.12:

Error: timeout (requestBody="{\"method\":\"eth_blockNumber\",\"params\":[],\"id\":52,\"jsonrpc\":\"2.0\"}", requestMethod="POST", timeout=120000, url="...snip...", code=TIMEOUT, version=web/5.0.11)
    at Logger.makeError (/opt/indexer/node_modules/@ethersproject/logger/lib/index.js:179:21)
    at Timeout._onTimeout (/opt/indexer/node_modules/@ethersproject/web/lib/index.js:148:35)
    at listOnTimeout (internal/timers.js:549:17)
    at processTimers (internal/timers.js:492:7)

The setup is as follows. After creating the Ethereum provider, we use it to make a number of contract calls and create transactions (as you would).

    const ethereum = new providers.StaticJsonRpcProvider(
      {
        url: ...,
        user: ...,
        password: ...,
        allowInsecureAuthentication: true,
      },
      "mainnet"
    )
    ethereum.pollingInterval = 4000

    ethereum.on('debug', info => { ... })

    ethereum.on('network', (newNetwork, oldNetwork) => {
      logger.trace('Ethereum network change', {
        oldNetwork: oldNetwork,
        newNetwork: newNetwork,
      })
    })

    logger.info(`Connected to Ethereum`, {
      pollingInterval: ethereum.pollingInterval,
      network: await ethereum.detectNetwork(),
    })

We have tested custom Ethereum nodes, Alchemy, Infura — the behavior is the same across all of them. I’m not entirely sure what leads to the eth_blockNumber calls, why they happen so frequently and why they all time out.

I’d be happy to provide more details if needed though.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
ricmoocommented, Jan 14, 2021

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

0reactions
mrwilliscommented, Feb 25, 2021

@ricmoo All good now thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is an unhandled promise rejection? - Stack Overflow
A rejected promise is like an exception that bubbles up towards the application entry point and causes the root error handler to produce...
Read more >
Node.js Process unhandledPromiseRejection Event
The unhandledRejection event is emitted whenever a promise rejection is not handled. NodeJS warns the console about ...
Read more >
How to solve "Unhandled Promise Rejection Warning" in my ...
I am following a youtube tutorial. I want to register a user and save their data in mysql database. It worked for the...
Read more >
Tracking Unhandled Promise Rejections - TrackJS
When a promise is rejected, it looks for a rejection handler. If it finds one, like in the example above, it calls the...
Read more >
Window: unhandledrejection event - Web APIs | MDN
The unhandledrejection event is sent to the global scope of a script when a JavaScript Promise that has no rejection handler is rejected; ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found