IT Error Decoder

How to Fix Vercel: function exceeded maximum execution time

Last reviewed

Error message

Function exceeded maximum execution time of <X> seconds. Function execution timed out.

Vercel functions are not the right tool for jobs that legitimately take minutes. They're sized for fast HTTP responses.

What this error means

A Vercel serverless or edge function ran longer than the configured timeout and was killed.

Why this happens

Long-running database query, external API not responding, infinite loop, or uncached recursive call. Default timeout on Hobby is 10s; on Pro it's higher but still bounded.

Quick fix (for end users)

  • Check the function code for obvious infinite loops or long awaits.
  • Test the function locally with a stopwatch to see how long it actually takes.

Admin / engineer fix

  • Increase the function's max duration if your plan allows.

    command
    // app/api/route.ts
    export const maxDuration = 60;
  • Move long work to a background job (queue it, return 202 Accepted, process out-of-band).

  • Cache expensive responses with `revalidate` or external Redis.

  • Check upstream services — a slow database query is the most common cause of timeouts.

Step-by-step fix

  1. Identify which function is timing out from the deployment logs.

  2. Profile it locally to find the slow path.

  3. Either speed it up or move work out of the request lifecycle.

Affected products

Vercel Functions · Vercel Edge Runtime

Common variations of this error

People also see these phrasings of the same problem:

  • Vercel function timeout
  • Lambda execution timeout

Still broken? Try these

  • If the function is timing out only intermittently, the upstream is the culprit.
  • Check Vercel's Edge Functions limits — they're stricter than Serverless.
  • Review your data layer for N+1 queries or missing indexes.

Related errors

Related searches

  • vercel function execution timeout
  • next.js api route timeout

Frequently asked questions

What's the max duration?

Plan-dependent. Hobby is 10s. Higher tiers allow 60s and beyond. Check your plan limits in Vercel docs.

Browse more errors in Vercel: Fix Vercel deployment errors. Build failures, missing output directories, exceeded build duration, missing env vars, and module resolution issues. Or paste your own error into the error decoder tool to find a match. You can also go back to the homepage to browse common errors by topic.