Vercel · HTTP 504

Vercel 504: FUNCTION_INVOCATION_TIMEOUT

Trace Vercel FUNCTION_INVOCATION_TIMEOUT to a function that exceeds its execution window. Inspect invocation duration, cold starts, and downstream waits.

Origin / Application

Decode a CDN or gateway error

Paste a captured HTTP response or enter a status and headers. Only the status and response headers are sent; common credential headers are filtered first.

Supports raw headers, full HTTP responses, JSON with status/statusCode and headers, cURL -v/-i response output, and HAR exports. HAR selects a server error first. cURL commands are never executed; request headers, response bodies, and common credential headers are excluded.

Diagnostic report

Error code / name

VERCEL-FUNCTION_INVOCATION_TIMEOUT

Fault domain

Origin / Application

Why it happened

The function did not finish before its configured maximum duration. Cold starts, synchronous report generation, and slow database or third-party calls can consume the available execution time.

Actionable fixes

  1. Match the x-vercel-id with function logs and inspect duration, cold-start time, and dependency spans.
  2. Move long-running work to a queue or background function and return a job identifier promptly.
  3. Set bounded timeouts for database and HTTP calls so the function can return a controlled response.

Why this error happened

The function did not finish before its configured maximum duration. Cold starts, synchronous report generation, and slow database or third-party calls can consume the available execution time.

Actionable fixes

  1. Match the x-vercel-id with function logs and inspect duration, cold-start time, and dependency spans.
  2. Move long-running work to a queue or background function and return a job identifier promptly.
  3. Set bounded timeouts for database and HTTP calls so the function can return a controlled response.

Network failure point

Client -> Vercel Edge -> function starts -> downstream work exceeds duration -> X response

Verify origin directly via CLI

curl -sS -I -w 'starttransfer=%{time_starttransfer} total=%{time_total}\n' --max-time 90 https://example.com/api/health

Configuration fix

app/api/report/route.tstypescript
export const maxDuration = 60;

export async function POST(request: Request) {
  const jobId = await enqueueReport(await request.json());
  return Response.json({ jobId }, { status: 202 });
}

Catch this failure before it becomes an outage

SteadyNode's HTTP checks track response latency and preserve gateway signatures, helping teams spot function-duration regressions before customer workflows time out.

No credit card required.

Start for free

Frequently asked questions

What does FUNCTION_INVOCATION_TIMEOUT mean?

The function exceeded its configured execution duration before returning an HTTP response.

Does increasing maxDuration always fix Vercel 504?

No. The project plan and runtime cap duration, and extending it can hide slow work. Measure the function and move durable long tasks out of the request path.

Cloudflare

Vercel and Netlify

AWS CloudFront and ALB

Fastly

Heroku and Render

Nginx and Envoy