Expose requestTimeout similarly to keepAliveTimeout #71651
akteigland
started this conversation in
Ideas
Replies: 1 comment
-
I have temporarily patched Next using patch-package and the following patch file: diff --git a/node_modules/next/dist/server/lib/start-server.js b/node_modules/next/dist/server/lib/start-server.js
index 8944a5b..c3d18e9 100644
--- a/node_modules/next/dist/server/lib/start-server.js
+++ b/node_modules/next/dist/server/lib/start-server.js
@@ -165,6 +165,9 @@ async function startServer(serverOptions) {
if (keepAliveTimeout) {
server.keepAliveTimeout = keepAliveTimeout;
}
+ // Update requestTimeout to allow for long lasting requests (i.e. file uploads)
+ // https://github.com/vercel/next.js/discussions/71651
+ server.requestTimeout = 3600000; // 1 hour
server.on("upgrade", async (req, socket, head)=>{
try {
await upgradeHandler(req, socket, head); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Allow Nodes requestTimeout to be set when calling
next start
Non-Goals
No response
Background
Next now requires Node v18.17. In Node 18, requestTimeout is now defaulted to 300000 (5 minutes). This means that long lasting requests will now timeout after five minutes. For example, I am attempting to upload large files using route handlers, but the requests always fail after 300 seconds. There is currently no way to adjust this timeout without patching Next.
Proposal
This setting can be adjusted in next/dist/server/lib/start-server.js, similar to keepAliveTimeout. I believe we should be able to make very similar changes as was done in #35827 to support requestTimeout as well. I would be happy to contribute.
Beta Was this translation helpful? Give feedback.
All reactions