Vercel Functions can time out from long-running tasks, inefficient code, or upstream service issues. The good news is that most timeouts trace back to a small set of causes, and the single most effective fix is the same in almost every case.
Here’s how to work through it, starting with that fix and ending with the edge cases that survive it.
Copy link to headingWhy do Vercel Functions time out?
Before touching or changing anything, it helps to know what you're fighting.
A Vercel Function times out for one of three reasons:
- It runs longer than its configured duration
- Its own code is inefficient
- An upstream service it depends on is slow or unresponsive
Long-running tasks and network-bound work are the usual culprits, and the same change often solves both.
That change is Fluid Compute.
Copy link to headingWhat is Fluid Compute?
Fluid Compute is Vercel’s next-generation compute model that bridges the gap between traditional dedicated servers and serverless architecture. It handles multiple concurrent requests within a single function instance rather than starting a new instance for every individual request.
The best way to avoid hitting limits is to use Fluid compute, which blends serverless flexibility with server-like capabilities, including the ability to run functions for up to 5 minutes on free plans and up to 800 seconds (roughly 13 minutes) on paid plans, with durations up to 30 minutes (1,800 seconds) available in beta for supported Node.js, Bun, and Python runtimes.
Copy link to headingHow does Fluid Compute fix function timeouts?
Fluid Compute is a hybrid solution that removes many of the traditional limitations of serverless functions in four ways:
- Optimized concurrency: Multiple function invocations can run on a single instance, reducing cold starts and improving resource utilization.
- Extended durations: Enjoy longer maximum durations (up to 800 seconds on Pro and Enterprise, or up to 1,800 seconds (30 minutes) in beta on supported Node.js, Bun, and Python runtimes) without additional configurations.
- Dynamic scaling and automatic cold start optimizations: Scale seamlessly during traffic spikes and benefit from bytecode caching to reduce cold starts.
- Background processing: Use
waitUntil(orafterwith Next.js) to continue tasks after sending an initial response.
If you frequently encounter timeouts or want to run network-intensive tasks, enabling Fluid Compute is your most effective long-term solution. Turning it on takes only a few clicks.
Copy link to headingHow to enable Fluid Compute
Once you’ve decided to use it, enabling Fluid Compute is a quick dashboard change:
- Open your project in the Vercel dashboard
- Click on Settings and select the Functions section
- Scroll to the Fluid Compute section and enable the toggle for Fluid Compute
- Click Save to apply your changes
- Redeploy your project for the changes to take effect
After you redeploy, the change takes effect across your functions. Fluid Compute is available on Node.js, Python, Edge, Bun, Go, Wasm, Ruby, and Rust runtimes, with optimized concurrency on Node.js and Python.
Copy link to heading4 more causes of function timeouts and how to troubleshoot
If you’re still encountering timeouts even after enabling Fluid Compute, the cause is usually in your function’s own logic or its dependencies.
Work through these four common causes in order.
Copy link to heading1. The function is taking too long
Start with how long your calls take.
Here are two things to check:
- Check API or database call durations: If these calls exceed your configured timeout, you’ll see timeouts.
- Extend your function’s duration if needed: You can override Fluid Compute defaults for even longer-running functions setting
maxDurationin the route segment config (up to 800 seconds on Pro and Enterprise, or up to 1,800 seconds (30 minutes) in beta on supported Node.js, Bun, and Python runtimes):
If you’re building AI applications, we recommend streaming, so the response starts returning before the full computation finishes. For work that needs to run longer than a single request allows, opt into Vercel Workflow for durable execution.
Copy link to heading2. No response is being returned
A function that never responds will always hit the ceiling. Always send an HTTP response, even an error. If your function never returns anything, Vercel will wait until the maximum duration has elapsed and then time out.
Make sure every code path ends in a response, including your error branches.
Copy link to heading3. Infinite loops
Unintended long-running functions are often loops that never exit. Inspect your logic for any loops or recursive calls that never terminate. This is a common cause of unintended long-running functions, and you can confirm it by inspecting your function runtime logs and observability.
If the logs show a function running right up to the limit with no output, a non-terminating loop is the likely cause.
Copy link to heading4. Upstream errors
Finally, look outside your own code at the services it depends on.
The fix is graceful handling. Verify third-party integrations or database connections. If upstream services fail to respond, handle the error gracefully and return a response, such as an error message, rather than waiting indefinitely.
Catching upstream failures and returning early keeps a slow dependency from consuming your full duration budget.
Copy link to headingNext steps
Create a new Vercel project with Fluid Compute enabled, or start from a template and deploy in minutes.