Supabase invoke doing nothing, possibly due to stale TCP connection issue
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
When calling supabase.functions.invoke from the Supabase JS library it sometimes does nothing at all and just hangs. No error and the invoked function is never triggered. In our production environment this happened 13 times out of 1772 over a specific period.
I filed this bug at the supabase-js repository (https://github.com/supabase/supabase-js/issues/2184) and they think it is because of an issue with stale TCP connections.
A quote from their reply (see issue for full reply)
Why the invoked function never starts: The key symptom is that the callee never executes at all. This rules out a bug in how the SDK processes the response, the HTTP request is simply never delivered to the target function. What most likely happens:
- Deno's fetch maintains a pool of reusable HTTP keep-alive connections for performance
- When your edge function calls functions.invoke(...), Deno picks a connection from that pool
- If that connection was silently closed by the server (e.g. the relay recycled it after an idle period), Deno doesn't know, the OS-level write to the socket buffer succeeds without error
- The remote side drops the packet because the connection is already gone on its end, but no TCP RST or FIN makes it back to Deno in time to trigger a rejection
- fetch waits indefinitely for a response that will never come → your outer function times out, the inner function never received the request
I think that the right fix is at the infrastructure layer: the Supabase relay or the Deno edge runtime should either send proper keep-alive probes, enforce shorter idle timeouts on pooled connections, or retry automatically on a fresh connection when a send fails with no response.
To Reproduce
Note that this will only happen in rare cases (13 out of 1772) rate
await supabase.functions.invoke('function', {
body: { foo: 'bar' }
})
Expected behavior
The invoked function is triggered as expected
System information
Node: 25.8.1 npm: 11.11.0 Deno: 2.7.5 supabase-js: 2.86.6
🔕 This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.