Fix: Vercel Serverless Function Timed Out
Quick Answer
Free plan functions timeout at 10 seconds, Pro at 60 seconds. Optimize your function: use connection pooling for database queries, add proper indexing, and move heavy operations to background jobs.
Quick Fix Summary
| Issue | Serverless function timeout |
| Fastest fix | Check your plan limits |
| Use this page if | Error: FUNCTION_INVOCATION_TIMEOUT |
Symptoms
- !Error: FUNCTION_INVOCATION_TIMEOUT
- !API route takes more than 10 seconds
- !Database queries work locally but timeout on Vercel
- !Webhook handler fails with timeout error
Step-by-Step Fix
Check your plan limits
Hobby (free): 10 second timeout. Pro ($20/mo): 60 second timeout. Enterprise: 900 seconds. If your function genuinely needs more time, upgrade your plan.
Add database connection pooling
If using Supabase/PostgreSQL, switch to the connection pooler URL (port 6543 instead of 5432). Serverless functions create new connections per request — pooling prevents connection overhead.
Optimize slow queries
Run EXPLAIN ANALYZE on your slow query in the database. Add indexes on columns used in WHERE clauses. Limit result sets with LIMIT instead of fetching all rows.
Move heavy work to background
For operations that take >10 seconds (image processing, bulk email, data migration), use a queue: Vercel Edge Functions + a background worker on Railway.
Frequently Asked Questions
Upgrade to Pro for 60 second timeout, or Enterprise for 900 seconds. There's no way to increase limits on the free plan.
Locally, there's no timeout. On Vercel, cold starts add 1-3 seconds + your function execution time. If your function takes 8 seconds locally, it may take 11 seconds on Vercel (exceeding the 10s free limit).
Related
Weekly Signals
Get the next fix, switch, or warning before it hits your build.
Join builders getting the community signals, fix patterns, and tool shifts that matter before they show up everywhere else.
Follow the signals →