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

Undici timeouts are not handled correctly #3136

Open
alcuadrado opened this issue Sep 5, 2022 · 13 comments
Open

Undici timeouts are not handled correctly #3136

alcuadrado opened this issue Sep 5, 2022 · 13 comments
Labels
effort:casual status:ready This issue is ready to be worked on type:bug Something isn't working

Comments

@alcuadrado
Copy link
Member

When upgrading to undici we introduced two problems:

  1. We are not passing the bodyTimeout here
  2. The way we are detecting if an error is a timeout is outdated here

Related to #2672

@alcuadrado alcuadrado added the good-first-issue Good for newcomers. Guidance available if needed label Sep 5, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2022

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

@ernestosperanza
Copy link

Is this issue open to work?

@fvictorio
Copy link
Member

@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).

@Saty248
Copy link
Contributor

Saty248 commented Dec 20, 2022

is this issue available to solve?

@fvictorio
Copy link
Member

It is, but check my previous comment.

@fvictorio fvictorio added type:bug Something isn't working priority:medium effort:casual status:ready This issue is ready to be worked on labels Dec 22, 2022
@fvictorio fvictorio removed their assignment Dec 27, 2022
@grapevinegizmos
Copy link

grapevinegizmos commented Jan 31, 2023

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.

@jacque006
Copy link

jacque006 commented Jan 31, 2023

@alcuadrado
Copy link
Member Author

I started working on this in #3665

@0x8f701
Copy link

0x8f701 commented Jun 28, 2023

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
image

@fvictorio fvictorio removed the good-first-issue Good for newcomers. Guidance available if needed label Nov 8, 2023
@0xCourtney
Copy link

I'm having a similar issue to #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.

@insider89
Copy link

Any update on this? Or workaround? I have the issue when trying to deploy smart contract on the Hedera Mainnet.

roderik pushed a commit to settlemint/solidity-empty that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-supplychain that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-token-erc20 that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-statemachine that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-token-erc721a that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-token-erc20-metatx that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-token-erc20-crowdsale that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-token-erc721 that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint/solidity-token-soulbound that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
roderik pushed a commit to settlemint-archive/solidity-token-erc721-cards that referenced this issue Jun 27, 2024
SCS failed to deploy on Hedera Mainnet without this timeout:
```
HeadersTimeoutError: Headers Timeout Error
    at Timeout.onParserTimeout [as callback] (/home/coder/usecase/node_modules/undici/lib/client.js:1048:28)
    at Timeout.onTimeout [as _onTimeout] (/home/coder/usecase/node_modules/undici/lib/timers.js:20:13)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7) {
  code: 'UND_ERR_HEADERS_TIMEOUT'
}
14081 |       console.warn("The node you are deploying to does not have access to a private key to sign this transaction.");
14082 |     }
14083 |     if (verify && import_lodash.isEmpty(process.env.ETHERSCAN_API_KEY)) {
14084 |       throw new Error("It is not possible to verify the deployment on this network unless you supply an Etherscan API key in the hardht.config.ts file");
14085 |     }
```
NomicFoundation/hardhat#2672

They have open issue to fix it:
NomicFoundation/hardhat#3136

This error happened for me only on Hedera Mainnet, testnet works fine.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Added a `timeout` parameter with a value of `100_000` to the BTP
configuration in the projects.
- The `timeout` property affects the BTP RPC settings for improved
functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@nsharmazbyte
Copy link

Any update on this? Or workaround? I have the issue when trying to deploy smart contract on the Hedera Mainnet.

Were you able to resolve this?

@insider89
Copy link

Were you able to resolve this?

I've added following setting to hardhat.config: timeout: 100_000, which resolve this issue for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort:casual status:ready This issue is ready to be worked on type:bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

10 participants