Skip to content
← Back to activity

Immutable solution version

Error: bind message supplies 1 parameters, but prepared statement "" requires 0

Version 1Sign in to save

Complete solution

How to fix 'Error: bind message supplies 1 parameters, but prepared statement "" requires 0' in Neon, straight from the verified resolution in gh:neondatabase/serverless#28. Root cause plus what to change.

What was reported

Issue neondatabase/serverless#28 (closed, 9 comments): ## Steps to reproduce Adding one or more parameters to the query cause the error: NeonDbError: db error: ERROR: bind message supplies 1 parameters, but prepared statement "" requires 0 when neonConfig.poolQueryViaFetch = true

neonConfig.poolQueryViaFetch = true
const pool = new Pool({ connectionString: env.DATABASE_URL })

const result = await pool.query(`SELECT * FROM "Client" WHERE id = '$1'`, [
  "xxxxxxxxxxxx",
])

Expected result

The same response as if the parameter were set inline like: `const result = await pool.query('SELECT * FROM "Client" WHERE id = "xxx

The verified resolution

[jawj (maintainer)]: Fixed in driver 0.4.23. Drizzle calls an odd hybrid form query({ text: 'SELECT ...' }, [...]) - neither the usual query(text, values) nor query({text, values}) - which the HTTP driver's poolQueryViaFetch path mishandled, producing the bind-message error. Reporter confirmed it works in 0.4.23.

Evidence

Asked in gh:neondatabase/serverless#28 (https://github.com/neondatabase/serverless/issues/28): Error: bind message supplies 1 parameters, but prepared statement "" requires 0. The issue report: Issue neondatabase/serverless#28 (closed, 9 comments): ## Steps to reproduce Adding one or more parameters to the query cause the error: NeonDbError: db error: ERROR: bind message supplies 1 parameters, but prepared statement "" requires 0 when neonConfig.poolQueryViaFetch = true

neonConfig.poolQueryViaFetch = true
const pool = new Pool({ connectionString: env.DATABASE_URL })

const result = await pool.query(`SELECT * FROM "Client" WHERE id = '$1'`, [
  "xxxxxxxxxxxx",
])

Expected result

The same response as if the parameter were set inline like: const result = await pool.query('SELECT * FROM "Client" WHERE id = "xxx The verified answer: [jawj (maintainer)]: Fixed in driver 0.4.23. Drizzle calls an odd hybrid form query({ text: 'SELECT ...' }, [...]) - neither the usual query(text, values) nor query({text, values}) - which the HTTP driver's poolQueryViaFetch` path mishandled, producing the bind-message error. Reporter confirmed it works in 0.4.23.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_MpobzEgRlo9NlVb6WCN-Ig" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Error: bind message supplies 1 parameters, but prepared statement &quot;&quot; requires 0 <span>— Vectle</span></a>