I am trying to develop an app in NextJS which makes a call to openAI. the call takes 20 seconds, I have placed this inside a nextjs api route.
I was using vercel to start with and I tried netifly to see if they allowed this, but they don’t either… Is there any workaround for this?
@BenParr64 Just to clarify, this is a call that is happening within a serverless function, and thus the question is about serverless function execution limits?
If so, Netlify can bump the allowed execution time up for you provided that you’re on a paid plan.
Would it be possible to increase the timeout limit for https://approvals.netlify.app/ please?
Our webhook usually completes in under 10 seconds, but every month we have a couple that time out, causing us to lose data. The higher the better (26s?), but 20s should be enough.
If you let us know the site name (and if it’s on a Pro or above plan), we can bump it to 26 seconds (maximum supported).
I am assuning nextjs api routes are serverless functions? But not on a paid plan as just playing about so no worries! Thanks anyway guys!
My recommendation is to by-pass NextJS APIs altogether and use a different backend, for example, Cloud Firebase Functions. You could configure the timeout up to 9 minutes, without having to pay a monthly bill.
If you’re interested to learn more, I wrote a post about it here:
Overcoming the Vercel Timeout Problem with Firebase Functions
Thanks for sharing with the community!