Edge Function takes too long to respond

Last edited: 2/6/2026

Edge Functions have a 60-second execution limit. If your function is taking too long to respond, follow these steps to diagnose and optimize performance.

Diagnose the issue

  1. Check function logs: Navigate to Functions > [Your Function] > Logs in the dashboard
  2. Examine boot times: Look for booted events and check for consistent boot times
  3. Identify bottlenecks: Review your code for slow operations

Analyze boot time patterns

  • If boot times are consistently slow: The issue is likely in your function's code, such as a large dependency, a slow API call, or a complex computation. Focus on optimizing your code, reducing dependency size, or implementing caching.

  • If only some boot events are slow: Find the affected region in the metadata and submit a support request via the "Help" button at the top of the dashboard.

Optimize database queries

Inefficient database queries are a common cause of slow responses:

1
// Good: Only select needed columns and limit results
2
const { data } = await supabase.from('users').select('id, name').limit(10)
3
4
// Avoid: Fetching all columns from large tables
5
const { data } = await supabase.from('users').select('*')

Common causes of slow functions

  • Large dependencies: Heavy packages increase boot time
  • Slow external API calls: Third-party services with high latency
  • Complex computations: CPU-intensive operations
  • Unoptimized database queries: Fetching more data than needed
  • Cold starts: First invocation after idle period takes longer

Additional resources