How to extend server action execute timing on vercle
Answered
Roseate Tern posted this in #help-forum
Roseate TernOP
My actions need to call external API which process is over 20s, but on Vercel it returning error 504 after 15.01s execute, is there any workaround?
Answered by Roseate Tern
NVM, it worked out.
For whoever be like me, https://vercel.com/docs/functions/configuring-functions/duration
just export maxDuration on the page.tsx then you're fine
ref: https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#how-server-actions-work
For whoever be like me, https://vercel.com/docs/functions/configuring-functions/duration
just export maxDuration on the page.tsx then you're fine
ref: https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#how-server-actions-work
11 Replies
Roseate TernOP
Roseate TernOP
NVM, it worked out.
For whoever be like me, https://vercel.com/docs/functions/configuring-functions/duration
just export maxDuration on the page.tsx then you're fine
ref: https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#how-server-actions-work
For whoever be like me, https://vercel.com/docs/functions/configuring-functions/duration
just export maxDuration on the page.tsx then you're fine
ref: https://nextjs.org/docs/app/building-your-application/data-fetching/forms-and-mutations#how-server-actions-work
Answer
Masai Lion
Hey @Roseate Tern ! I've faced the exact same problem and I was getting a TS error when I tried to export maxDuration on the page. I did it anyway after reading your message and it worked! Thank you so much.
Masai Lion
Oh btw, did you also get the TS error? Do you know if there is a specific TS config/version to avoid it? Thanks!
@Masai Lion Oh btw, did you also get the TS error? Do you know if there is a specific TS config/version to avoid it? Thanks!
Roseate TernOP
you're using webstorm right? I suggest to ignore it, it seem like a bug from webstorm not nextjs
i'm using vscode so I'm not seeing the error, I checked on webstorm and seem like it bugged
Masai Lion
Oh you're right
Yes no build errors, it's more an IDE one, I'll see if there is an update
Thanks again!
Roseate TernOP
ðŸ‘