Next.js Discord

Discord Forum

Requests timing out when deployed to Vercel.

Unanswered
Blue-winged Warbler posted this in #help-forum
Open in Discord
Blue-winged WarblerOP
I am making an app where all api routes call open and replicate AI, which takes up to a minute to fulfill. Thus these requests timeout when deployed to Vercel. However, everything works perfectly fine locally. Is there any way to fix this without extra databases or AWS Lambda

4 Replies

So you have two paths to follow:
1. Upgrade to the pro plan on vercel - this lets you set function exec times to up to 300s
2. Use edge functions if you can - If an edge function returns a stream within 25 seconds of its invocation it can run indefinitely. So getting the response then streaming it to the client is a good solution
I was running into the exact same issue yesterday...