-
Notifications
You must be signed in to change notification settings - Fork 30k
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
fetch fails with internal error after 5 minutes #46375
Comments
It says so why in the error message: Working as intended, not a bug. I'll close this but I can convert it to a conversation if you have follow-up questions. |
@bnoordhuis , thank you for the response |
I think for fetch() the answer is "no" but node's own |
This should absolutely be documented, given the current expectation of node's native fetch implementation being a swap-in replacement for the browser implementation. I just ran into this issue while building an AWS Lambda extension layer, which requires a long-running network request that only responds when the function is next invoked. This may sometimes require the request to remain open for longer than 5 minutes between invocations. I understand these timeouts are configured by the underlying undici implementation - which itself is currently causing a concerning level of turbulence in the global fetch API, for example: #46706 It's unfortunate that configureable timeouts were not considered when shipping global.fetch cc @mcollina |
fetch() is a standard. The standard doesn't say anything about timeouts. It's up to implementers to pick reasonable defaults. If you want more control, use node's own http client. |
Configuring a custom agent in undici will allow to change these defaults. |
@mcollina can this be done natively? I reviewed this test and the Agent appears to be incompatible with node's native agents: https://github.com/nodejs/undici/blob/7827031d2a7fd99f8ab9d5eddce127c6f700dd35/test/fetch/fetch-timeouts.js |
I am having a similar issue. I have a node server running with nodemon. If the laptop, running windows, is closed while the nodemon server is running. After waiting a while and the opening the latptop again, then this issue appears. Restarting the laptop fixes the problem. |
To anyone who still encounters the issue even though they don't use any VPN's or Firewall, try to change your DNS to use Manual. I change mine to : |
Thanks, you saved my life. i have used const makeHttpRequest = (options, postData) =>
}); |
@mcollina @bnoordhuis the way this seems to be handled according to MDN is with timeout/abort signals is there a reason that node chose to diverge from that standard? Undici clearly seems capable of waiting forever if configured correctly? Is this same configuration possible without a direct dependency on undici? In my particular case looker's sdk handles the configuration for node's fetch so I don't have a direct way to configure this even if that's possible. |
I want to kindly request to re-open this issue as I don't believe it is resolved.
According to previous comments, there is a hard coded limitation of 5min for Node.js native I would like to highlight my issue with this: we are using native fetch in WebdriverIO where we make requests to initiate automate mobile sessions using Appium. It sometimes takes longer than 5min to setup the phone correctly and allow automation on it. We have received an issue for this here: webdriverio/webdriverio#13783 The amount of linked issues clearly shows that folks have issues with this situation. Is there any contribution I can make to resolve this? I am happy to jump into the code if the team believes that just increasing this timeout would be a good approach. |
"Working As Intended" is an annoying way of saying that you're too lazy to fix something that should be configurable, instead of hard coded. And, that's just annoying. Thank you! |
Version
18.13.0, 19.5.0
Platform
Microsoft Windows NT 10.0.19044.0 x64
Subsystem
docker image from node:19-alpine
What steps will reproduce the bug?
Error occurres with simple get request (didn't tested it with other options), which lasts longer then 5 minutes:
How often does it reproduce? Is there a required condition?
This error occures every time when there is no response longer then 5 minutes
What is the expected behavior?
fetch
should wait as long as needed, even if response will be returned in 10+ minutesWhat do you see instead?
Next error occurs when I do http request, which lasts longer than 5 minutes:
Additional information
No response
The text was updated successfully, but these errors were encountered: