# Vercel FUNCTION_INVOCATION_TIMEOUT

> Fix Vercel 504 FUNCTION_INVOCATION_TIMEOUT: check maxDuration, plan limits, slow upstream calls and missing responses, with config for Next.js and vercel.json.

Canonical: https://scaplet.com/errors/cdn/vercel-function-invocation-timeout

Guide Error · CDN and hosting errors

Fix Vercel 504 FUNCTION_INVOCATION_TIMEOUT: check maxDuration, plan limits, slow upstream calls and missing responses, with config for Next.js and vercel.json.

3 min

read

5

sources

Nov 1, 2026

updated

Scaplet Editorial Team

author

In one line

Vercel returns a 504 FUNCTION_INVOCATION_TIMEOUT when a function runs longer than its allowed duration. With Fluid compute the default is 300 seconds on every plan, and the maximum is 300 seconds on Hobby and 800 seconds on Pro and Enterprise. Find the slow call or the missing response, or set `maxDuration` within your plan's limit.

30-second check

## Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?

Summarize this page with [ChatGPT](https://chatgpt.com/?hints=search&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fvercel-function-invocation-timeout%20(%22Vercel%20FUNCTION_INVOCATION_TIMEOUT%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Claude](https://claude.ai/new?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fvercel-function-invocation-timeout%20(%22Vercel%20FUNCTION_INVOCATION_TIMEOUT%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [Perplexity](https://www.perplexity.ai/search?q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fvercel-function-invocation-timeout%20(%22Vercel%20FUNCTION_INVOCATION_TIMEOUT%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.) [![Google](/logos/ai/google-color.svg)AI Mode](https://www.google.com/search?udm=50&q=Summarize%20https%3A%2F%2Fscaplet.com%2Ferrors%2Fcdn%2Fvercel-function-invocation-timeout%20(%22Vercel%20FUNCTION_INVOCATION_TIMEOUT%22)%20in%205%20bullet%20points%2C%20then%20tell%20me%20the%20one%20thing%20I%20should%20do%20next.)

On this page

## 5 parts, 3 minutes.

1. [What the error is 01](#what-the-error-is)
2. [The four causes Vercel lists 02](#the-four-causes-vercel-lists)
3. [Set maxDuration, by framework 03](#set-maxduration-by-framework)
4. [Check it in 2 minutes 04](#check-it-in-2-minutes)
5. [What a 504 means for crawling 05](#what-a-504-means-for-crawling)

_01_Duration limits with Fluid compute (Node.js, Bun and Python)

## What the error is

Vercel's error page says `FUNCTION_INVOCATION_TIMEOUT` occurs "when a function invocation takes longer than the allowed execution time", and the status is [504 Gateway Timeout](/errors/http/504). The cause can be an error inside the function, a slow network call, or the environment the function runs in. The duration counts "time spent processing the request and sending the response, including streamed responses".

Plan

### Hobby

Default

300 seconds

Maximum

300 seconds

Extended maximum

None

Plan

### Pro

Default

300 seconds

Maximum

800 seconds

Extended maximum

1800 seconds (beta)

Plan

### Enterprise

Default

300 seconds

Maximum

800 seconds

Extended maximum

1800 seconds (beta)

Values above 800 seconds are beta, need function-level configuration, and apply only to listed runtime versions. Functions on the Edge runtime must begin sending a response within 25 seconds to keep streaming, and can stream for up to 300 seconds.

_02_Causes and fixes

## The four causes Vercel lists

Cause

### The function is taking too long

What to check

API and database calls against your plan's duration limit

Fix

Speed them up, or consider Fluid compute for longer durations; use Vercel Workflows for unlimited execution time

Cause

### The function is not returning a response

What to check

Every code path ends in a returned HTTP response, even an error

Fix

Return a response on all paths. Without one the function times out

Cause

### An infinite loop

What to check

Loops and retries that can never finish

Fix

Fix the loop

Cause

### Upstream errors

What to check

The external API or database you call

Fix

Check it for errors

**An unhandled exception is a common trigger**Vercel points to unhandled exceptions as a common cause and says the application logs are at the deployment URL under the `/_logs` path, for example `https://my-deployment-my-username.vercel.app/_logs`.

_03_Fix it on your stack

## Set maxDuration, by framework

Next.js app router: app/api/my-function/route.ts
Next.js app router: app/api/my-function/route.ts

```
export const maxDuration = 5; // This function can run for a maximum of 5 seconds export function GET(request: Request) { return new Response('Vercel', { status: 200 }); }
```

vercel.json: other frameworks, older Next.js, Rust, Go, Python or Ruby
vercel.json: other frameworks, older Next.js, Rust, Go, Python or Ruby

```
{ "$schema": "https://openapi.vercel.sh/vercel.json", "functions": { "api/test.js": { "maxDuration": 30 }, "api/*.js": { "maxDuration": 15 }, "src/api/*.js": { "maxDuration": 25 } } }
```

vercel.json: a Python framework app keys on its entrypoint
vercel.json: a Python framework app keys on its entrypoint

```
{ "$schema": "https://openapi.vercel.sh/vercel.json", "functions": { "app/main.py": { "maxDuration": 60 } } }
```

Vercel notes that the order of file patterns matters, and that a Next.js project using a `src` directory must prefix function routes with `/src/`. You can also set a project default in the dashboard under Settings, then Functions, in the Function Max Duration section. A function that runs longer than its set maximum is terminated, so choose a value that allows normal work, including streamed responses, without letting a runaway run long.

_04_How it works

## Check it in 2 minutes

1. 1

### Reproduce with timing

Run `curl -sS -o /dev/null -w "%{http_code} %{time_total}s\n" https://your-app.vercel.app/api/slow`. A 504 after your configured duration confirms the timeout and tells you which limit applied.
2. 2

### Read the logs

Open the `/_logs` path of the deployment URL, as Vercel describes, and look for the invocation that ran long.
3. 3

### Time the slow call

Add timing logs around each database or API call. The one that eats most of the duration is the fix target.
4. 4

### Confirm every path returns

Walk the handler. A branch that awaits a promise that never resolves, or ends without a `Response`, leaves the request open until the limit.

Time the endpoint

```
curl -sS -o /dev/null -w "%{http_code} %{time_total}s\n" https://your-app.vercel.app/api/slow
```

_05_Explained

## What a 504 means for crawling

A 504 is a 5xx to Google. [Googlebot](/ai-crawlers/googlebot) slows down on 5xx and 429, keeps indexed URLs for a time, and "eventually" drops them if the errors persist. Keep pages that should rank well inside the duration limit, and see timeout errors for finding affected URLs.

Questions

## Asked a lot.

4 questions people ask next, answered from the sources on this page.

_01_ What is the Vercel function timeout?

With Fluid compute, 300 seconds by default on Hobby, Pro and Enterprise. The maximum is 300 seconds on Hobby and 800 seconds on Pro and Enterprise, with a beta extended maximum of 1800 seconds for supported runtimes on Pro and Enterprise.

_02_ How do I fix FUNCTION_INVOCATION_TIMEOUT?

Find what makes the function slow: an upstream call, a missing return, a loop or an unhandled exception. Then fix it or raise `maxDuration` within your plan limit, using `export const maxDuration` in the route or `functions` in `vercel.json`.

_03_ Is FUNCTION_INVOCATION_TIMEOUT a 504 or a 500?

Vercel documents it as 504 Gateway Timeout.

_04_ What should I use for work longer than the maximum?

Vercel recommends Vercel Workflows for workloads that need unlimited execution time, since they can pause, resume and keep state without duration limits.

Sources · 5

## Every fact, linked and dated.

Official docs first. The date is when we last opened each page.

- vercel.com
- google.com
- mozilla.org

1. 01 [Vercel Docs: FUNCTION_INVOCATION_TIMEOUT](https://vercel.com/docs/errors/FUNCTION_INVOCATION_TIMEOUT) vercel.com · checked 2026-11-01
2. 02 [Vercel Docs: Configuring maximum duration for Vercel Functions](https://vercel.com/docs/functions/configuring-functions/duration) vercel.com · checked 2026-11-01
3. 03 [Vercel Docs: Vercel Functions limits](https://vercel.com/docs/functions/limitations) vercel.com · checked 2026-11-01
4. 04 [How HTTP status codes affect Google's crawlers](https://developers.google.com/crawling/docs/troubleshooting/http-status-codes) developers.google.com · checked 2026-11-01
5. 05 [MDN: 504 Gateway Timeout](https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Status/504) developer.mozilla.org · checked 2026-11-01

## Keep learning

[All errors](/errors)

[Learn Netlify function timeout CDN and hosting errors](/errors/cdn/netlify-function-timeout) [Related 5xx server errors Status codes and links](/seo-issues/server-errors-5xx) [Read next Vercel 413: FUNCTION_PAYLOAD_TOO_LARGE CDN and hosting errors](/errors/cdn/vercel-payload-too-large) [Do Run a free site audit Free, about two minutes](/site-audit)

More Vercel errors
[Vercel 500: Internal Server Error](/errors/cdn/vercel-500) [Vercel build failed](/errors/cdn/vercel-build-failed) [Vercel domain not working](/errors/cdn/vercel-domain-not-working) [Vercel: too many redirects](/errors/cdn/vercel-too-many-redirects) [Vercel 413: FUNCTION_PAYLOAD_TOO_LARGE](/errors/cdn/vercel-payload-too-large)

More in CDN and hosting errors
[Heroku H12: Request timeout](/errors/cdn/heroku-h12-request-timeout) [Heroku H13: Connection closed without response](/errors/cdn/heroku-h13) [Heroku H14: No web processes running](/errors/cdn/heroku-h14) [Netlify build failed](/errors/cdn/netlify-build-failed) [Netlify function timeout](/errors/cdn/netlify-function-timeout) [Render 502 Bad Gateway](/errors/cdn/render-502) [S3 Access Denied (403 Forbidden)](/errors/cdn/s3-access-denied) [Vercel 413: FUNCTION_PAYLOAD_TOO_LARGE](/errors/cdn/vercel-payload-too-large) [Vercel 429: Too Many Requests](/errors/cdn/vercel-429) [Vercel 500: Internal Server Error](/errors/cdn/vercel-500) [Vercel build failed](/errors/cdn/vercel-build-failed) [Vercel domain not working](/errors/cdn/vercel-domain-not-working) [Vercel FUNCTION_INVOCATION_TIMEOUT](/errors/cdn/vercel-function-invocation-timeout) [Vercel: too many redirects](/errors/cdn/vercel-too-many-redirects) [Akamai reference number](/errors/cdn/akamai-reference-number) [ALB 503 Service Unavailable](/errors/cdn/alb-503) [ALB 504 Gateway Timeout](/errors/cdn/alb-504-gateway-timeout) [API Gateway 403 Forbidden](/errors/cdn/api-gateway-403-forbidden) [API Gateway 504 Gateway Timeout](/errors/cdn/api-gateway-504) [AWS 502 Bad Gateway](/errors/cdn/aws-502-bad-gateway) [AWS Amplify 404 Not Found](/errors/cdn/amplify-404) [AWS EC2: Connection timed out](/errors/cdn/aws-ec2-connection-timed-out) [AWS Lambda 502 Bad Gateway](/errors/cdn/aws-lambda-502) [AWS Lambda timeout](/errors/cdn/lambda-timeout)

Free · 2 minutes

## Tools point. Agencies advise. _This one ships._

Run the free audit, then approve the fixes. Every change can be undone.

[Audit my site free](/site-audit)

Free, no card 60 seconds Nobody will call you

- **46** fixes shipped without a ticket Brightpipe
- **0→7** ChatGPT citations in six weeks Paylane
