HTTP 504 Gateway Timeout in Vercel
Vercel — serverless deployment platform for Next.js and edge apps.
What triggers it in Vercel
A serverless function exceeded the max duration (10s on Hobby, 60s on Pro, 900s on Enterprise) or the edge middleware timed out (25s hard cap).
Log example
[GET] /api/report status=504
FUNCTION_INVOCATION_TIMEOUTHow to fix it on Vercel
Move long tasks to a queue (Vercel Queues, Inngest, QStash), stream the response, or upgrade the function's `maxDuration` in `vercel.json`.
Where you'll see it
Vercel's Edge Network, serverless function logs, or the deployment dashboard.
Monitor 504 responses continuously
Lemwatch checks your Vercel endpoints as often as every 5 minutes and alerts the moment a 504 pattern appears — with the full response headers and body captured, so you can debug without waiting for the next customer report.
Same error on other platforms
504 Gateway Timeout in Vercel — FAQs
A serverless function exceeded the max duration (10s on Hobby, 60s on Pro, 900s on Enterprise) or the edge middleware timed out (25s hard cap).
Move long tasks to a queue (Vercel Queues, Inngest, QStash), stream the response, or upgrade the function's `maxDuration` in `vercel.json`.
504 on Vercel is usually transient — it clears once the underlying resource (function, upstream API, or cache node) recovers. If it persists more than 5 minutes across regions, treat it as a real incident and check Vercel's Edge Network, serverless function logs, or the deployment dashboard..
Persistent 504s damage SEO in two ways simultaneously. First, Google deindexes pages that consistently fail to respond — same as any 5xx error. Second, even when the page eventually responds, the slow response time hurts Core Web Vitals (specifically LCP — Largest Contentful Paint), which is a confirmed ranking factor. A 504 that intermittently resolves into a 6-second 200 is still a ranking problem. Fix the backend slowness, don't just bump the proxy timeout. On Vercel specifically, Googlebot sees the same 504 your users see, so unresolved errors get reflected in Search Console's Page indexing report within days.
Set up an HTTP monitor that pings your key Vercel endpoints from multiple regions every 1–5 minutes and alerts on any non-2xx response. Lemwatch does this out of the box — including capturing the full response headers and body when a 504 hits, so you can debug without waiting for the next user report.
Both are server error responses, but they mean different things: 504 Gateway Timeout indicates a proxy or gateway server didn't receive a response from the upstream server in time — the "slow backend" failure mode that's different from 502 (broken backend)., while 500 is a distinct condition with its own root cause. On Vercel, the fix path and the log signature are different — check the exact status code your Vercel logs return before applying a fix.