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

Hello @sid.mann!

Would you be able to increase the Lamda timeout duration for:
dev-quest.netlify.app

I am on the Pro Plan as well. Thank you!

Hello @nathanmartin!

I am running into the same issue with a Next.js/OpenAI timeout and was wondering if you would be able to increase the Lamda timeout duration for:
dev-quest.netlify.app

I am on the Pro Plan as well. Thank you!

@dtulpa16 I can’t do anything for you, as I don’t work for Netlify :slight_smile:

One of the Netlify Support Team members will spot your request though.

As you’re on the Pro Plan you’re eligible to lodge support requests via ticket here too:
https://www.netlify.com/support/

Thank you! Apologies about the confusion. Been a long day of troubleshooting this :sweat_smile:

Hi @dtulpa16,

Thanks for reaching out! I’ve increased the function time limit to 26 seconds for the site. You’ll need to re-deploy the site for the change to take effect.