Skip to content

fix(db): pass driver options to postgres-js#844

Merged
atinux merged 1 commit intomainfrom
fix/postgres-driver-options
Feb 24, 2026
Merged

fix(db): pass driver options to postgres-js#844
atinux merged 1 commit intomainfrom
fix/postgres-driver-options

Conversation

@onmax
Copy link
Contributor

@onmax onmax commented Feb 15, 2026

Closes #840

Summary

connection options like prepare: false are silently dropped when creating postgres-js clients. Only url is extracted; everything else is discarded. Breaks Supabase transaction pooler (port 6543) which requires prepare: false.

drizzle-orm already forwards extra connection fields to postgres() via const { url, ...config } = connection; postgres(url, config). For the simple case (no replicas), we now let drizzle handle client creation. For replicas/lazy init, we strip only url and spread the rest.

StackBlitz

Link Expected
Bug nuxthub-840 prepare missing from postgres() call
Fix nuxthub-840-fix prepare: false present

CLI Reproduction

git clone --depth 1 --filter=blob:none --sparse https://github.com/onmax/repros.git
cd repros && git sparse-checkout set nuxthub-840
cd nuxthub-840 && pnpm i && pnpm build
# Check node_modules/@nuxthub/db/db.mjs — prepare is missing

Verify fix

git sparse-checkout add nuxthub-840-fix
cd ../nuxthub-840-fix && pnpm i && pnpm build
# Check node_modules/@nuxthub/db/db.mjs — prepare: false is present

The -fix folder uses pnpm patch to apply the fix locally.

@vercel
Copy link

vercel bot commented Feb 15, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
nuxthub Error Error Feb 15, 2026 5:05pm

@onmax onmax force-pushed the fix/postgres-driver-options branch from 4e88b0b to 02c3a19 Compare February 15, 2026 17:04
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 15, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
playground 02c3a19 Commit Preview URL

Branch Preview URL
Feb 15 2026, 05:06 PM

@pkg-pr-new
Copy link

pkg-pr-new bot commented Feb 15, 2026

npm i https://pkg.pr.new/@nuxthub/core@844

commit: 02c3a19

Copy link
Contributor Author

@onmax onmax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NuxtHub-specifci fields (hyperdriveId, accountId, etc.) leak into postgresOpts, which is benign but could be cleaner

Comment on lines -49 to +48
const { default: postgres } = await import(clientPkg)
client = postgres(connection.url, {
onnotice: () => {}
})
pkg = 'drizzle-orm/postgres-js'
const { drizzle } = await import(pkg)
return drizzle({ client, casing })
return drizzle({ connection: { ...connection, onnotice: () => {} }, casing })
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onnotice cannot be given to the drizzle client @onmax

Where did you see this was possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing onnotice via connection is supported by drizzle postgres-js driver (it proxies the options to postgres-js), right?

@atinux atinux merged commit 2a1bc5b into main Feb 24, 2026
9 of 10 checks passed
@atinux atinux deleted the fix/postgres-driver-options branch February 24, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NuxtHub db config ignores driver options (prepare: false) for Supabase Transaction Pooler

2 participants