Skip to content

Commit 0190b02

Browse files
committed
fix(protect): disable prepared statements for pooled PG connections
The CI DATABASE_URL uses a connection pooler (Supabase PgBouncer in transaction mode) which does not support server-side prepared statements. The postgres.js driver caches statement names by SQL signature and skips Parse on reuse, but PgBouncer may route the Bind to a different backend that has no knowledge of the cached statement. Pass prepare: false to the postgres client so each query uses the unnamed statement protocol (Parse + Bind + Execute per query).
1 parent 97f1bf7 commit 0190b02

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/protect/__tests__/searchable-json-pg.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ if (!process.env.DATABASE_URL) {
88
throw new Error('Missing env.DATABASE_URL')
99
}
1010

11-
const sql = postgres(process.env.DATABASE_URL)
11+
const sql = postgres(process.env.DATABASE_URL, { prepare: false })
1212

1313
const table = csTable('protect-ci-jsonb', {
1414
metadata: csColumn('metadata').searchableJson(),

0 commit comments

Comments
 (0)