hardhat
hardhat copied to clipboard
Undici timeouts are not handled correctly
When upgrading to undici we introduced two problems:
- We are not passing the
bodyTimeouthere - The way we are detecting if an error is a timeout is outdated here
Related to https://github.com/NomicFoundation/hardhat/issues/2672
This issue is also being tracked on Linear.
We use Linear to manage our development process, but we keep the conversations on Github.
LINEAR-ID: 14ad93d2-d907-4826-a94c-3e9132847d06
Is this issue open to work?
@ernestosperanza sure, but make sure that you can reproduce the issue (check #2672) and that your fix indeed fixes it (see https://github.com/NomicFoundation/hardhat/blob/main/CONTRIBUTING.md#developing-locally to learn how to test a fix locally).
is this issue available to solve?
It is, but check my previous comment.
This is a blocking problem for me. Hoping we get a solution soon.
Its worth noting that I see this problem (code "UND_ERR_HEADERS_TIMEOUT" only when I run on LocalHost. When I run the same code on on the transient bockchain (with hh test) I get no error.
Workaround from @samlaf : https://github.com/NomicFoundation/hardhat/issues/2672#issuecomment-1167409582 Example workaround implementation: https://github.com/web3well/bls-wallet/pull/341/files#diff-a2a940145025870fd09caa9fa093009d69793c78c5c9203195280575e5e4efb1R138-R143
I started working on this in #3665
SocketError: other side closed
at Socket.onSocketEnd (/home/ubuntu/paraspace-core/node_modules/undici/lib/client.js:995:22)
at Socket.emit (node:events:525:35)
at Socket.emit (node:domain:489:12)
at endReadableNT (node:internal/streams/readable:1359:12)
at processTicksAndRejections (node:internal/process/task_queues:82:21) {
code: 'UND_ERR_SOCKET',
socket: {
localAddress: '127.0.0.1',
localPort: 36506,
remoteAddress: undefined,
remotePort: undefined,
remoteFamily: undefined,
timeout: undefined,
bytesWritten: 616,
bytesRead: 678
}
}
is this error relevant? @alcuadrado @fvictorio I got this error when I run hardhat node on a VPS, but I cannot reproduce it locally on my PC
I cannot add timeout field to hardhat network config
I'm having a similar issue to https://github.com/NomicFoundation/hardhat/issues/2672 with requests that take more than ~20s, it seems that the Hardhat provider (more specifically Undici) will timeout. If anyone is in a similar situation, using the Ethers provider JsonRpcProvider instead of Hardhat seems to do the trick.
Any update on this? Or workaround? I have the issue when trying to deploy smart contract on the Hedera Mainnet.