Repository navigation
Prisma 7.10.1 Schema Engine returns P1001 on Windows, but PostgreSQL driver connects successfully #30879
Replies: 5 comments
|
The reason you're seeing this discrepancy comes down to Prisma 7's architecture: runtime queries and CLI schema operations use two completely different networking and TLS stacks under the hood. 1. Why
|
|
The error code narrows this down quite a bit. In Prisma 7.10.1, What P1001 does and doesn't mean In the engine's error mapping (quaint
So a certificate-store problem would normally show up as P1011, not P1001. P1001 means the binary either couldn't open the TCP connection or didn't finish connecting within the timeout. Things to check, given that
Seeing the underlying error without leaking credentials The CLI pipes the engine's stderr into the $env:DEBUG = "prisma:schemaEngine:stderr"
$env:RUST_LOG = "debug"
npx prisma migrate statusUsing that one namespace instead of Applying your migrations in the meantime
DATABASE_URL_UNPOOLED="postgresql://...?sslmode=require&connect_timeout=30" npx prisma migrate deployI'd avoid running the |
|
The reason this happens is due to the difference between how Node.js handles TLS/DNS vs. how Prisma's native Rust Schema Engine handles them on Windows: 1. Why
|
|
Thank you for your email and support, with your help the issue is solved
Regards
…On Thu, 29 Oct, 2026, 6:37 am Praveen Kumar, ***@***.***> wrote:
The reason this happens is due to the difference between *how Node.js
handles TLS/DNS vs. how Prisma's native Rust Schema Engine handles them on
Windows*:
------------------------------
1. Why pg / @prisma/adapter-pg works, but Schema Engine returns P1001
- *Node.js runtime ***@***.***/adapter-pg and pg)*: Uses Node's built-in
JavaScript/C++ network stack, which ships with Mozilla's pre-compiled CA
certificate bundle and Node's DNS resolver.
- *Prisma CLI (prisma migrate status, db pull)*: Does *not* use
@prisma/adapter-pg. Instead, the CLI spawns the native Rust binary (
schema-engine-windows.exe), which connects using Rust's tokio-postgres
and the Windows system certificate store (rustls-native-certs /
Schannel).
When connecting to Neon (*.neon.tech) from Windows, two common
discrepancies cause P1001 in Rust while succeeding in Node:
1. *Server Name Indication (SNI) & TLS Handshake*: Neon multiplexes
connections based on the SNI hostname (ep-xyz-123456.region.neon.tech).
If the connection string lacks an explicit sslmode=require, or if a
Windows firewall/VPN/proxy intercepts the TLS handshake, Node's pg
driver may tolerate it while Rust's strict TLS verification rejects the
socket before sending the startup packet.
2. *Windows Certificate Store vs. Let's Encrypt / ISRG Root*: The Rust
engine queries the Windows user/machine certificate store. If the ISRG Root
X1 or intermediate CA certificate is missing or not synced in the Windows
trust store, the Rust TLS handshake fails immediately with a socket
disconnect, which Prisma surfaces as P1001 (Cannot reach database
server).
------------------------------
2. How to reveal the exact underlying Rust error (Safe Diagnostics)
Run the command with the RUST_LOG environment variable enabled. This
forces the native Schema Engine to print its exact socket and TLS error
before returning P1001, without printing your credentials:
In PowerShell:
$env:RUST_LOG="debug,quaint=trace"$env:DEBUG="prisma:schema-engine*"
npx prisma migrate status --config=prisma.stage10.config.ts
In the output, look specifically for lines like:
- tls: certificate verify failed: UnknownIssuer (Missing root CA in
Windows store)
- tls: invalid peer name (SNI mismatch)
- connection reset by peer / timeout (Port 5432 routing / MTU issue)
------------------------------
3. Immediate Fixes to Try A. Explicit SSL & Connect Timeout Parameters
Ensure your Neon unpooled connection string explicitly specifies:
***@***.***/neondb?sslmode=require&connect_timeout=30
*(If using sslmode=require still fails, test sslmode=verify-full).*
B. Direct IP vs IPv6 Resolution on Windows
Windows frequently attempts IPv6 resolution first. If your local network
or ISP has partial IPv6 routing, Node may fall back to IPv4 faster than
Rust's socket connection timeout. Test forcing the IPv4 address if
applicable, or increase connect_timeout=30.
------------------------------
4. Supported Workaround to Apply Migrations
If you need to unblock migration execution immediately while
troubleshooting the native engine socket on Windows:
1. *Apply migrations using prisma db execute* (which also accepts SQL
files), or:
2. *Apply migration SQL files directly using a small script with
@prisma/adapter-pg or pg*:
Because pg connects cleanly, you can run:
import fs from "fs";import path from "path";import { Client } from "pg";
async function runMigrations() {
const client = new Client({ connectionString: process.env.DATABASE_URL_UNPOOLED });
await client.connect();
// Read and apply migration.sql in transaction
const sql = fs.readFileSync(path.join("prisma/migrations", "<migration_dir>", "migration.sql"), "utf-8");
await client.query(sql);
await client.end();}runMigrations();
Once applied, when the schema engine connects it will see the tables
and match the migration checksums.
—
Reply to this email directly, view it on GitHub
<#30879?email_source=notifications&email_token=BTOL37SVFKI6CF7HMKJ22BT5WKJ4NA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJSGU3TAMRTUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVRTG633UMVZF6Y3MNFRWW#discussioncomment-19257023>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BTOL37QQWYVEPOPGPBOCOAD5WKJ4NAVCNFSNUABIKJSXA33TNF2G64TZHMYTSMRZGI2TQMZTHNCGS43DOVZXG2LPNY5TCMJRGM3TOMBUUF3AE>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/BTOL37T4VQCMIAX6FNQEYYD5WKJ4NA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJSGU3TAMRTUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVJTG633UMVZF62LPOM>
and Android
<https://github.com/notifications/mobile/android/BTOL37RUANVHJV44KYXMUWT5WKJ4NA5CNFSNUABIM5UWIORPF5TWS5BNNB2WEL2ENFZWG5LTONUW63SDN5WW2ZLOOQXTCOJSGU3TAMRTUZZGKYLTN5XKMYLVORUG64VFMV3GK3TUVZTG633UMVZF6YLOMRZG62LE>.
Download it today!
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
|
The reason this happens is due to the difference between how Node.js handles TLS/DNS vs. how Prisma's native Rust Schema Engine handles them on Windows: 1. Why
|
Uh oh!
There was an error while loading. Please reload this page.
Prisma 7.10.1 Schema Engine returns P1001 on Windows, but PostgreSQL driver connects successfully
Hello Prisma team,
I'm troubleshooting a connection issue between Prisma ORM and a fresh Neon PostgreSQL database. I need help identifying why Prisma's native Schema Engine cannot connect when the PostgreSQL driver and Prisma adapter can connect successfully.
Environment
@prisma/adapter-pg: 7.10.1pg: 8.23.1public, currently emptyWhat works
pgdriver.pg.@prisma/adapter-pg, including a successfulSELECT current_database()query.npx prisma validate.What fails
Both commands return
P1001:The failure persists with both direct and pooled Neon endpoints, after trying a longer connection timeout, removing
channel_binding=require, changing SSL mode, preferring IPv4, and upgrading Prisma packages from 7.10.0 to 7.10.1.Prisma 7 configuration
prisma.config.ts:prisma/schema.prisma:The Schema Engine executable starts and reports its version correctly. No migrations have been applied to the fresh database.
Questions
P1001whenpgand@prisma/adapter-pgconnect successfully from the same Windows machine?I want to use Prisma's existing migration history to initialize the fresh database without modifying production data.
Thank you.
All reactions