Skip to content

Document serverless and pooler configuration #12

Open

Description

@okomarov

Document how to run the client reliably on serverless and behind poolers. Most of the protection comes from configuration the client cannot set by itself.

Content

Activity

  1. added
    enhancement
    on Oct 9, 2026
  2. moved this to Next in Roadmapon Oct 15, 2026
  3. added
    area: connections
    documentation
    upstream
    on Oct 16, 2026
  4. okomarov commented on Oct 17, 2026

    @okomarov
    Author

    For the pooler section: the measured cost of the extra round trip with prepare: false is now in the README under Parameter types (once docs/client-measured lands), with the full numbers on #41. parameter_types: 'client' belongs in the recommended pooler setup next to prepare: false; the median query went from 5.3 to 3.1 ms behind the Supabase pooler.

    The numbers this issue still waits on are the serverless ones from #8 (freeze behaviour, which server timeouts cover which failure).

  5. okomarov commented on Oct 19, 2026

    @okomarov
    Author

    Findings from the Cloudflare edge tier (#157, #158) and a free Supabase project set up for CI. The vendors' own docs confirm each one.

    Hyperdrive in front of a transaction-mode pooler does not work. CI ran the Hyperdrive scenario (50 concurrent insert-and-select pairs, max: 5, prepare: true) on both builds at two compatibility dates:

    Hyperdrive in front of Rounds passed
    Neon, direct all
    Neon, PgBouncer pooler all
    Supabase, direct connection all
    Supabase, Supavisor transaction mode (6543) none: prepared statement does not exist (26000), CONNECTION_CLOSED, timeouts (run 39234865111)

    The docs say the same:

    So behind Hyperdrive, keep prepare: true and point it at the database. Supabase's direct host is IPv6-only on the Free plan, and Hyperdrive reaches it. Its certificate chains to Supabase's private root CA. Workers cannot verify that root over their own sockets, but Hyperdrive can with the CA uploaded and verify-full.

    Supavisor transaction mode without Hyperdrive. Locally, through port 6543:

    • With prepare: true, one query works, 20 queued on one connection stall after 6, and five connections give does not exist.
    • With prepare: false, 600 mixed queries and sql.begin() transactions all returned the right rows, with pipelining on and with max_pipeline: 0.

    Supabase's postgres.js page now warns that postgres.js pipelining "can hang queries or return mismatched rows" in transaction mode. It also says max_pipeline: 0 "breaks sql.begin() transactions instead, a known upstream bug" (porsager#1210). That warning was added in supabase/supabase#50712, which says Supavisor 2.10 will add native pipelining support.

    That bug does not apply to this fork: it was fixed in 4.0.0 and is covered by the begin-pipeline-zero lease test (CHANGELOG, 4.0.0), and sql.begin() with max_pipeline: 0 also worked through Supavisor's session and transaction modes. 600 queries do not rule out the hang Supabase describes, so max_pipeline: 0 stays the recommendation for transaction mode until Supavisor 2.10, and the docs can say Supabase's caveat is upstream-only.

    One setup mistake. A role connection limit of 20 produced CONNECTION_CLOSED that looked like pooler failures. Supavisor's logs showed 53300 too many connections for role, since Hyperdrive's and Supavisor's pools both count against the role. Size a role's limit for every pool in front of it.

  6. okomarov commented on Oct 20, 2026

    @okomarov
    Author

    The Hyperdrive bullet is covered: docs/api.md, Hyperdrive says to point Hyperdrive at the database itself (Supabase's direct connection, not Supavisor's transaction mode), keep prepare: true, and use max: 5 and fetch_types: false; the Workers TLS section says certificates are always verified there and a private CA needs Hyperdrive with verify-full. CI runs Hyperdrive in front of Neon (direct and pooled) and Supabase's direct connection on Cloudflare's network on every change. Shipped in 4.6.0-rc1. The other bullets are still open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: connectionsdocumentationenhancementupstream

    Type

    No type

    Projects

    • Status
      Next

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions