PatchVault › Errors › @vercel/kv & @vercel/postgres → Upstash + Neon

VercelPostgresError: VercelPostgresError - 'missing_connection_string': You did not supply a 'connectionString' and no 'POSTGRES_URL' env var was found.

@vercel/postgres could not find a connection string: no connectionString option and no POSTGRES_URL in the environment where the query ran.

Check your code free (runs in your browser)

The box is pre-filled with a sample that triggers this error. Paste your own file to check it. Nothing leaves this page.

Or scan your whole repo locally (free, stdlib Python, read-only):

python3 <(curl -fsSL https://patchvault-81y.pages.dev/starters/vercel-kv-scan.py) .
Get the @vercel/kv & @vercel/postgres → Upstash + Neon auto-fixer: $9 one-time

Why it happens

Typical causes: the query runs in a client component (non-public env vars are server-only), env vars were not pulled locally, or a Vite build does not expose process.env (vercel/storage #708). Vercel Postgres databases have since been migrated to Neon, and the integration usually provides DATABASE_URL.

Manual fix

npm install @neondatabase/serverless

// server-only module
import { neon } from '@neondatabase/serverless'
export const sql = neon(process.env.DATABASE_URL ?? process.env.POSTGRES_URL!)
const rows = await sql`SELECT * FROM users WHERE id = ${id}`   // returns rows directly

Verify

Re-run your install/build and re-scan the file above. The finding should be gone. The paid fixer applies the same change across a repo: --dry-run shows the diff, --apply keeps a .bak of each file, and --rollback restores them.

Sources

Related errors

Full guide and free terminal scanner: @vercel/kv & @vercel/postgres → Upstash + Neon. Last checked 2026-10-31.