Timeout 10 Seconds

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?

Cheers

@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.

See:

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!

Hi @hrishikesh .

Can you increase my timeout to the max on this site :

brokerbacon.netlify.app.

I’m on the pro plan. Thanks

@dilrajahdan I’ve increased the timeout to 26 seconds, our network max. You’ll need to redeploy the site to see those changes take effect.

Thank you. Netlifys support is so fast! I’m really impressed