Addressing Socket Hang-Up Issues in Next.js Rewrites with Prolonged Request Times
Unanswered
West African Lion posted this in #help-forum
West African LionOP
In my Next.js application, I'm encountering socket hang-up errors specifically when utilizing rewrites, especially in scenarios where the request takes longer than 30 seconds to complete. Strikingly, normal fetch requests without rewrites don't exhibit this connection hang-up issue. I'm seeking guidance on resolving this issue to ensure seamless performance. How can I effectively address socket hang-ups in the context of Next.js rewrites with extended request times?
2 Replies
Barbary Lion
Yes, we are facing the same issue
Red-billed Tropicbird
After days of struggling... i am coming back here with a solution...
the timeout of 30 seconds is Vercel limitation
https://vercel.com/docs/limits/overview#proxied-request-timeout
so i needed to add experimental proxyTimeout in
now my huge file of 400MB is naturally uploaded without being interrupted by socket hung up
Happy coding!
the timeout of 30 seconds is Vercel limitation
https://vercel.com/docs/limits/overview#proxied-request-timeout
so i needed to add experimental proxyTimeout in
next.config.js like so async rewrites () {
return [
{...}
];
},
experimental: {
proxyTimeout: 60000, // Set proxy timeout more than 30 seconds
}, now my huge file of 400MB is naturally uploaded without being interrupted by socket hung up
Happy coding!