Skip to content

stack (native runtime): WebSocket upgrade on a reused keep-alive connection gets 101 but is never relayed — Realtime never subscribes #7429

Closed

Description

@jcroguen-bit

Summary

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.

Reproduction (Node 24.15, @supabase/supabase-js 2.116.0)

import { createClient } from "@supabase/supabase-js";
const c = createClient(API_URL, SECRET_KEY, { auth: { persistSession: false } });
// a few ordinary requests to the same gateway, on kept-alive connections
for (let i = 0; i < 6; i++) await Promise.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).

Activity

  1. 7ttp commented on Nov 1, 2026

    @7ttp
    Member

    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.

  2. self-assigned this
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions