Evanss
Evanss

Reputation: 23142

Increase execution limit for Server Action in NextJS / Vercel?

I have a Server Action in NextJS14 hosted on Vercel. In the Vercel logs I can see the function is timing out:

Execution Duration / Limit.    15.01s / 15s (timed out)

I'm calling the OpenAI API which can be slow. How do I increase the time limit?

Upvotes: 3

Views: 1106

Answers (1)

Melo
Melo

Reputation: 31

You must apply a new max duration inside your top level page.tsx:

export const maxDuration = 90;

export async function Page(){ }

Inside route-segment in next-js docs you can find more information about it.

Upvotes: 3

Related Questions