© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•6mo ago
Karan

Edge Function 504 Timeout on Concurrent Requests

Issue: PostgreSQL trigger calls edge function via
supabase_functions.http_request()
supabase_functions.http_request()
. Concurrent identical requests result in:
- ✅ Request A: Success (12s)
- ❌ Request B: 504 timeout (150s)

Environment:
@supabase/supabase-js@2
@supabase/supabase-js@2
, PostgreSQL triggers, Deno edge functions

Evidence from invocation logs:
// Successful
{"deployment_id": "abc_123", "status_code": 200, "execution_time_ms": 12317}

// Failed  
{"deployment_id": null, "status_code": 504, "execution_time_ms": 150235, "function_id": null}
// Successful
{"deployment_id": "abc_123", "status_code": 200, "execution_time_ms": 12317}

// Failed  
{"deployment_id": null, "status_code": 504, "execution_time_ms": 150235, "function_id": null}


Key Issue:
deployment_id: null
deployment_id: null
suggests request never reached function instance. Same trigger/payload but different outcomes.

Trigger:
EXECUTE FUNCTION supabase_functions.http_request (
  'https://project.supabase.co/functions/v1/my-function',
  'POST',
  '{"Content-type":"application/json"}',
  FORMAT('{"record":{"id":%s}}', NEW.id),
  '7500'
);
EXECUTE FUNCTION supabase_functions.http_request (
  'https://project.supabase.co/functions/v1/my-function',
  'POST',
  '{"Content-type":"application/json"}',
  FORMAT('{"record":{"id":%s}}', NEW.id),
  '7500'
);


Workaround:
PERFORM pg_sleep(random() * 2);
PERFORM pg_sleep(random() * 2);


Question: Is this expected for concurrent edge function calls? Seems like gateway routing issue vs application code.

Anyone else seeing 504s with
deployment_id: null
deployment_id: null
?

Tags:
edge-functions
edge-functions
database
database
triggers
triggers
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Edge function frequently returns 504
SupabaseSSupabase / help-and-questions
8mo ago
Scheduled Edge Function Timeout
SupabaseSSupabase / help-and-questions
3y ago
Local supabase edge function timeout
SupabaseSSupabase / help-and-questions
2y ago
Concurrent Edge Functions
SupabaseSSupabase / help-and-questions
5mo ago