You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
stack (native runtime): WebSocket upgrade on a reused keep-alive connection gets 101 but is never relayed — Realtime never subscribes #7429
With the experimental stack engine ([experimental] stack = true, supabase start --runtime native, CLI 2.122.0, macOS arm64), a Realtime WebSocket that a Node.js process opens after it has made ordinary HTTP requests to the same API port never goes live. The gateway answers the upgrade 101, but no frame is relayed, so channel.subscribe() never reaches SUBSCRIBED.
Node's built-in WebSocket (undici) upgrades through the process's shared HTTP connection pool, so it reuses an idle kept-alive connection to the gateway. A fresh process, with no requests before the WebSocket, subscribes in ~12 ms. The Docker runtime's Kong gateway did not have this problem.
import{createClient}from"@supabase/supabase-js";constc=createClient(API_URL,SECRET_KEY,{auth: {persistSession: false}});// a few ordinary requests to the same gateway, on kept-alive connectionsfor(leti=0;i<6;i++)awaitPromise.all([1,2,3].map(()=>c.from("profiles").select("id").limit(1)));c.channel("job:x",{config: {private: true}}).subscribe((s)=>console.log(s));// never SUBSCRIBED
Without the for loop: SUBSCRIBED in ~12 ms.
With it: nothing for 10 s+. The gateway log shows GET /realtime/v1/websocket?... HTTP/1.1" 101; Realtime logs no join and no error; realtime-js's logger shows push phx_join but never transport connected.
Giving the WebSocket its own connections works around it (new WebSocket(url, { dispatcher: new Agent() }) from undici): SUBSCRIBED in ~6 ms.
Expected
A WebSocket upgrade on a reused HTTP/1.1 keep-alive connection is relayed like one on a new connection (as with the Docker runtime's gateway).
its currently in release v3.0.0-beta.17 🙂 we're having a stable release on monday (v3) it'll be out in that, do give it a try and let us know if u stumble upon anything else!
Activity
7ttp commentedon Nov 1, 2026
thanks for this! @jcroguen-bit 💚
tho i think its already fixed in a recent pr here:
its currently in release v3.0.0-beta.17 🙂 we're having a stable release on monday (v3) it'll be out in that, do give it a try and let us know if u stumble upon anything else!
closing this up for now.