Next.js Discord

Discord Forum

Is there any timeout limitation for API end points on a VPS?

Answered
Samyar posted this in #help-forum
Open in Discord
I'm aware that Vercel does not allow more than 60s requests. But what about if i deploy to VPS?
For example this code, the long promise can take hours to finish does it keep going in background event though the request is gone?

export const GET = () => {
  longPromise.then(() => {
    // Handle what happens when longPromise is done, like logging or something else
  }).catch((error) => {
    // Handle errors that may occur
    console.error("Error occurred:", error);
  });

  // Immediately return the response without waiting for the promise
  return Response.json({ done: true });
};
Answered by riský
in theory it should be able to last forever (assuming your server/process is still alive)
View full answer

4 Replies

in theory it should be able to last forever (assuming your server/process is still alive)
Answer
yup, there are no timeouts when you self-host a next project
yeah, i just haven't tested it to its extent so didnt want to say anything absolute - good to hear it can last for ages!
great