Repository navigation
docs: warn about postgres.js pipelining on Supavisor transaction mode - #50712
Conversation
Re-does #50082 against the redesigned connecting-to-postgres page. Adds a short caution in the new "Transaction mode limitations" section that redirects postgres.js users to the postgres-js guide, which keeps the full warning, the prepare: false workaround, and a "contact support" prompt for anyone still stuck. Drops the standalone troubleshooting page per team discussion, since we're not confident enough yet to officially recommend the porsager/postgres patch. Co-Authored-By: Claude Sonnet 5 <[email protected]>
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: supabase/supabase/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe database guides now document query pipelining limitations in transaction mode, Postgres.js workarounds, and the updated connection example. The spelling configuration allows pipeline-related terms. ChangesPostgres pipelining documentation
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Other Suggested reviewers: Merge Risk: ⚪ Minimal · up to This documentation-only change clarifies PostgreSQL pipelining limitations and workarounds without changing product behavior, so it is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Matches the other Transaction mode limitations items (Prepared statements, Cursors, Session-level state), which are plain bold-led paragraphs rather than admonitions. Co-Authored-By: Claude Sonnet 5 <[email protected]>
czenko
left a comment
There was a problem hiding this comment.
Before merging, I recommend passing this through docs/CONTRIBUTING and our WORD-LIST or using our /edit-the-docs skill.
| <Admonition type="caution"> | ||
|
|
||
| `postgres.js` pipelines queries by default. Combined with [the shared pooler transaction mode](/docs/guides/database/connecting-to-postgres#pooler-transaction-mode) , this can hang queries or return mismatched rows. `postgres.js` has no working option to turn pipelining off directly: `max_pipeline: 0` breaks `sql.begin()` transactions instead, a known upstream [bug](https://github.com/porsager/postgres/issues/1189). | ||
|
|
||
| An upcoming Supavisor release will add native pipelining support in the transaction mode. | ||
|
|
||
| If you need more guidance on the pipelining with `postgres.js`, [contact support](/dashboard/support/new). | ||
|
|
||
| </Admonition> |
There was a problem hiding this comment.
Want to double check that this ran through our docs CONTRIBUTING guide and WORD_LIST. We also have a skill called /edit-the-docs for this.
There are a few style issues:
- A small grammatical typo: there's a space before the comma ` ,'.
- 'An upcoming Supabisor release...' goes against Timeless Documentation. This is at risk of going stale.
- 'If you need more guidance...' can be. 'For more about X, see Y'
- Inconsistent linking convention. A new style guide will merge shortly that will include more linking conventions. Here's an external source on linking from the Google guide: Write descriptive link text
There was a problem hiding this comment.
Inconsistent linking convention. A new style guide will merge shortly that will include more linking conventions. Here's an external source on linking from the Google guide: Write descriptive link text
That's a duplicate link.
There was a problem hiding this comment.
Co-authored-by: Miranda Limonczenko <[email protected]>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
A critical quickstart issue and additional documentation corrections remain unresolved.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
What changed in this PR
Updates database documentation to warn about postgres.js pipelining incompatibility with Supavisor transaction mode.
Changes:
- Documents transaction-mode pipelining limitations and failure risks.
- Adds Postgres.js guidance, support escalation, and upstream context.
- Updates the connection example to disable prepared statements.
| File | Summary | Findings |
|---|---|---|
apps/docs/content/guides/database/postgres-js.mdx |
Adds pipelining warnings and updates connection guidance. | Critical quickstart guidance remains unsafe for transaction mode; moderate prepared-statement and spelling allow-list issues; nit on roadmap wording. |
apps/docs/content/guides/database/connecting-to-postgres.mdx |
Documents pipelining under transaction-mode limitations. | Moderate link-description issue and nit regarding adjacent admonitions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| const connectionString = process.env.DATABASE_URL | ||
| const sql = postgres(connectionString) | ||
| const sql = postgres(connectionString, { prepare: false }) |
There was a problem hiding this comment.
This is not true. Whether a transaction pooler is used or not depends on the connection string passed through the DATABASE_URL.
Braintrust eval report
|
## Why Since #29, every full page load of `/charging` in prod hung until Vercel's 300 s timeout (504); client-side navigation still worked. postgres.js pipelines a query onto a busy connection (after a parameterless query, with `prepare: false`), and Supabase's transaction pooler drops the replies to pipelined queries. #29 put a parameterless query (`tariff.list`) into an SSR loader that runs ~15 queries at once. During a live hang, prod `pg_stat_activity` showed one backend per request `active` / `ClientRead`, waiting for a query the client never finished. Supabase documents the incompatibility (supabase/supabase#50712) and advises against `max_pipeline: 0`, which breaks `sql.begin()` (porsager/postgres#1189). node-postgres sends one query per connection and waits for its reply. ## What changed - Drizzle on `pg` (`drizzle-orm/node-postgres`) instead of postgres.js, with a pool `error` handler: pg otherwise crashes the process on an idle client's socket error. - `sslmode=require`/`prefer` URLs get `uselibpqcompat=true`: pg otherwise reads them as `verify-full` and rejects Supabase's certificate. That would have broken the app and `drizzle-kit migrate` in `vercel-build`, so encrypt-without-verify stays as it was. - No `attachDatabasePool`: its ~10 s `waitUntil` per query would bill Fluid instances ~100× longer (ADR-0018). - Separate commit: `connectionTimeoutMillis` 10 s and `query_timeout` 30 s, so a future stall errors fast instead of burning 300 s. - Driver differences: `constraint` instead of `constraint_name`, `{ rows }` from raw `execute`, `test/setup.ts` on the pg pool. ## Verification - [x] `bun run check` clean - [x] `bun run build` passes (tsc + bundle) - [x] `bun run test` passes: 98 files, 990 tests - [ ] Preview deploy: `drizzle-kit migrate` connects over TLS, and a full page load of `/charging` renders and hydrates. The stall only happens behind Supabase's pooler, so it can't be reproduced locally. - Two reviews (code/ADR, and adversarial). Both blockers fixed: the pool `error` handler and not forcing libpq semantics on `sslmode=no-verify`. ## Risks / follow-ups - The first deploy is the first pg + Supabase TLS connection, including migrations. Watch the build's migrate step. - A query that times out inside a transaction leaves its client busy, so the rollback can still wait. - postgres.js stays in `bun.lock` only as drizzle-orm's optional peer; nothing imports it. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>

Re-does #50082 against the redesigned
connecting-to-postgres.mdx(see Slack discussion).What changed vs. #50082:
connecting-to-postgres.mdx: the pipelining caution now lives in the new Transaction mode limitations section (the old "Pooler transaction mode" prose it was in got redesigned), and is a short redirect to the Postgres.js guide rather than a full explanation.postgres-js.mdx: keeps the full warning, the{ prepare: false }workaround, and now explains why pipelining can't just be turned off (max_pipeline: 0breakssql.begin(), tracked in BEGIN can reach PostgreSQL without reserving the transaction connection porsager/postgres#1189), plus a "contact support" prompt for anyone still stuck, and a note that Supavisor v2.10 will add native pipelining support.postgres.jspatch, so support is the escalation path for now instead.Rule003Spelling.tomlallow-list entry for "pipelining" (not present onmaster).🤖 Generated with Claude Code
Summary by CodeRabbit
Preview
postgres.jspipelining warning with even more details: https://docs-git-docs-postgres-js-pipelining-warning-supabase.vercel.app/docs/guides/database/postgres-js