Immutable solution version
NeonDbError: prepared statement does not exist
Complete solution
Serverless: neonDbError: prepared statement does not exist. The verified fix is Fixed server-side; reporter confirmed no failures on the new version, rolling out with the weekly compute release. Use this when you hit the symptoms above in serverless; not for unrelated serverless errors or general setup questions.
When it applies
Not specified by the original author.
Instructions
TL;DR
Fixed server-side; reporter confirmed no failures on the new version, rolling out with the weekly compute release. No SDK change needed.
The error
However when performing multiple calls in parallel, the request sometimes fails with the following errors:
error: NeonDbError: prepared statement "s257" does not existFix
- Fixed server-side; reporter confirmed no failures on the new version, rolling out with the weekly compute release.
- No SDK change needed.
Success check: the symptom above is gone and the original operation completes.
When to use
- You hit this exact symptom in serverless.
- You want the verified fix without digging through the thread.
When not to use
- A different error in serverless, even a similar-looking one.
- General serverless setup or credential questions.
Compatibility
- Serverless (neondatabase/serverless)
Variant phrasings
- How to fix "neonDbError: prepared statement does not exist" in serverless
- serverless: neonDbError: prepared statement does not exist
Root cause
[conradludgate (Neon proxy engineer)]: Root cause found in Neon's proxy code: for RLS the proxy runs 'discard all' between user sessions for security, which discarded the cached prepared statements the proxy uses for Postgres type mapping of enum/composite types.
Edge cases
- [conradludgate (Neon proxy engineer)]: Root cause found in Neon's proxy code: for RLS the proxy runs 'discard all' between user sessions for security, which discarded the cached prepared statements the proxy uses for Postgres type mapping of enum/composite types.
Source
- https://github.com/neondatabase/serverless/issues/144
Evidence
Asked in gh:neondatabase/serverless#144 (https://github.com/neondatabase/serverless/issues/144): NeonDbError: prepared statement does not exist. The issue report: Issue neondatabase/serverless#144 (closed, 16 comments): I'm using a Neon database in combination with Drizzle. My application setup uses Hono and sets up the pooling connection string using @neondatabase/serverless and drizzle-orm/neon-http. Besides that RLS Authorize is enabled.
However when performing multiple calls in parallel, the request sometimes fails with the following errors:
error: NeonDbError: prepared statement "s257" does not existSteps to reproduce
I have the following function setup, which was required to otherwise prevent infinite recursion in the RLS logic:
-- This is a workaround to bypass RLS for t The verified answer: [conradludgate (Neon proxy engineer)]: Root cause found in Neon's proxy code: for RLS the proxy runs 'discard all' between user sessions for security, which discarded the cached prepared statements the proxy uses for Postgres type mapping of enum/composite types. It only surfaced when parallel queries used different enums (needing fresh catalog lookups). Fixed server-side; reporter confirmed no failures on the new version, rolling out with the weekly compute release. No SDK change needed.By @issueatlas · Version 2 · Exact version
Maintainer review
Checking maintainer review for this exact version…
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
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_TK9NzkmxbKl_OmBnjEC6gg" 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">NeonDbError: prepared statement does not exist <span>— Vectle</span></a>