Server Actions and MaxDuration?
Unanswered
Transvaal lion posted this in #help-forum
Transvaal lionOP
I've been developing an application using server actions, but they routinely take more than 15s (they are calling the GPT-4 api), so I've been trying to increase the duration of the function.
Using vercel.json and a permissive glob (src/*/) I'm getting an error that no function exist under that path
Adding
Adding
Do I really have to refactor to use an API route now? I've been really enjoying server actions...
Tried on latest nextjs and on canary, deploying on vercel
Using vercel.json and a permissive glob (src/*/) I'm getting an error that no function exist under that path
Adding
export const maxDuration = 60 in the "use server" file that export the function throws an error (only async functions are allowed as export)Adding
export const maxDuration = 60 in the layout file (both root and closest to the function) is also ignoredDo I really have to refactor to use an API route now? I've been really enjoying server actions...
Tried on latest nextjs and on canary, deploying on vercel
6 Replies
Oak apple gall wasp
any updates on this?
Chinese Egret
From docs: "Server Actions inherit the runtime from the page or layout they are used on.
"
"
And: "The Route Segment options allows you configure the behavior of a Page, Layout, or Route Handler"
Does not seem to work on server actions, even if you specify it on the route or layout
Jersey Wooly
I'm struggling with 504s on server actions as well. Can someone confirm if the only solution currently is, in fact, a refactor to api routes?
@Jersey Wooly I'm struggling with 504s on server actions as well. Can someone confirm if the only solution currently is, in fact, a refactor to api routes?
Oak apple gall wasp
As an update, I created an issue on nextjs which they fixed already, now u should be able to use server actions and max duration without any problem.
Please note :
1. On free plan maxDuration is 15s
2. Pro plan from 1m to 5m.
3. Custom have no clue but probably more? I am not sure
Please note :
1. On free plan maxDuration is 15s
2. Pro plan from 1m to 5m.
3. Custom have no clue but probably more? I am not sure