Lovable
api
Supabase Edge Function Timeouts or Fails to Execute
Edge function requests timeout after 120 seconds with 504 Gateway Timeout. Function doesn't execute or returns 500 error. Async operations timeout. Functions work locally but fail in production.
Supabase Edge Functions have strict timeout limits and require optimization for fast execution. Network calls and database queries must complete quickly.
Error Messages You Might See
504 Gateway Timeout
408 Request Timeout
Function execution timed out
Connection timeout
Common Causes
- Long-running operations exceeding 120 second timeout
- Waiting for external API without timeout
- Database query returning too much data
- Missing await on async operations
- Cold start delays on first invocation
How to Fix It
Add timeout to external requests:
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 5000);
const response = await fetch(url, { signal: controller.signal });
clearTimeout(timeoutId);Offload long operations to background jobs. Optimize database queries with indexes and limits.
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get Help