Watch: Fix Vercel "504: FUNCTION_INVOCATION_TIMEOUT" | Vovy
Watch Vovy do it on a Mac: "My API route times out with FUNCTION_INVOCATION_TIMEOUT, fix it". Vovy finds which step in your API route is slow, explains Vercel's time limits for your plan, and moves long work out of the request so it stops timing out.
"My API route times out with FUNCTION_INVOCATION_TIMEOUT, fix it"
Vovy finds which step in your API route is slow, explains Vercel's time limits for your plan, and moves long work out of the request so it stops timing out.
What happens in the video
- Find the timed-out requests: Vovy filters Vercel Logs for 504 and FUNCTION_INVOCATION_TIMEOUT, which means your function ran past its maximum duration and got cut off.
- Check your duration limit: It reads your plan and the maxDuration setting. With Fluid compute, Hobby functions cap at 300 seconds; Pro can go to 800.
- Time each step of the route: Cursor adds temporary timing logs around each external call, like an AI request or a big database query, to see which one hangs.
- Move slow work to the background: For long jobs, Vovy sets up a queue with Upstash QStash so the route answers right away and the work finishes separately.
- Confirm it responds in time: You get a card with the old and new response time and which step was the culprit.
Read the step-by-step guideLoading...