whocanfixmyapp

Home / Problems / AI APIs and integrations

Serverless or edge function timed out

VC-61VercelSupabaseNetlifyUpdated October 2026By

Quick verdict

Partly fixable yourself. Raising a limit is quick, restructuring a job is not.

How serious
Medium
Fix it yourself?
Partly, some steps need a developer
Typical cost
€99–$990 for a single fix (prices)
Top rated for Supabase
Redlab · 10.0/10

What you see. Long actions like AI generation, PDF export or imports fail with a 504 or FUNCTION_INVOCATION_TIMEOUT after a fixed number of seconds.

Why it happens

Server functions on hosting platforms have a time budget. On Vercel, functions default to 300 seconds, which is also the ceiling on Hobby, while Pro and Enterprise can raise it to 800 seconds. Vercel Edge runtime functions must start responding within 25 seconds. Netlify synchronous functions stop at 60 seconds and that cannot be changed, while background functions run up to 15 minutes. Supabase Edge Functions get 150 seconds on the Free plan, 400 on paid plans, 2 seconds of CPU time per request, and the caller gets a 504 if nothing is sent within 150 seconds.

The function usually hits the limit because it waits on something slow, an AI model, a big database query, or an external API. Vercel also lists a function that never returns a response, an endless loop, and an unhandled exception as common causes. Preview rarely shows this because you tested with small inputs.

Fix it yourself

  1. Find which function failed. The URL tells you: /api/ on Vercel, /.netlify/functions/ on Netlify, /functions/v1/ on Supabase. Open that host's logs and find the last line before the timeout.
  2. Compare how long the step takes with the limit for your host and plan listed above. If you are close, the job needs a different shape, not a bigger number.
  3. On Vercel you can raise the budget within your plan with export const maxDuration = 60 in the route file, or a functions block in vercel.json.
  4. Ask your builder: Put a timeout on every outbound call, catch errors, and always return a response, even an error one.
  5. For work that genuinely takes minutes, move it to a background job: a Netlify background function, Vercel Workflows, or a queue. The page starts the job, gets an id, and polls for the result.
  6. If the slow step is a database query, check that the columns you filter on have indexes. That is check COST-02.

When to get an engineer

Get an engineer when the job really needs minutes, because turning a request into a background job with status polling touches the database, the function, and the page. Tell them the host, the plan, the failing function, and a typical input size. A single fix is €99–$990 and takes two to five days. Ask them to add a progress state in the UI so users know the job is running.

Top-rated companies for Supabase apps

Ranked by our score: published prices, scope of work, AI tools named, timing and a low-risk first step. How we score.

  • 1Redlab10.0/10Best for: A full rescue by one team that keeps buildingFree first step · from $490
  • 2Vibe Code Rescue (Lev Arakelyan)9.0/10Best for: A one-off check and a cleanupFrom $299
  • 3LazyCodeLab9.0/10Best for: A one-off check and a cleanupFrom $399

All 29 Supabase companies, ranked

Check these

COST-02Medium

Database columns you filter on are indexed

Queries that scan whole tables are fast at 100 rows and slow at 100,000.

OPS-03High

Errors reach you before users do

Add error monitoring and uptime alerts. If you learn about outages from customers, this is missing.

COST-01High

AI and paid API calls have per-user limits

Without a cap, one user or one bot loop can spend your monthly budget in an hour.

PAY-03High

Input is validated on the server

Forms that only check input in the browser accept anything sent directly to the API.

Questions

Can I just raise the limit to the maximum?

On Vercel Pro up to 800 seconds, yes. On Hobby, Netlify synchronous functions and Supabase the limits are fixed. A longer wait also costs more and still fails if the upstream call hangs.

Why is only the live site affected?

Local development has no time limit, and preview tests use small inputs. Real users upload bigger files and ask longer questions.

Sources: Vercel: functions limits; Vercel: FUNCTION_INVOCATION_TIMEOUT; Netlify: functions configuration; Supabase: Edge Function limits.