#Local development: Error: P1017

13 messages · Page 1 of 1 (latest)

terse dew
#

I successfully completed the Quickstart for Prisma Postgres at https://www.prisma.io/docs/prisma-orm/quickstart/prisma-postgres.

I then tried Local development at https://www.prisma.io/docs/postgres/database/local-development. I was able to complete Step 1.

Loaded Prisma config from prisma.config.ts.

✔  Your local Prisma Postgres server default is now running 👍

🔌 To connect with Prisma ORM use the following connection strings:

DATABASE_URL="postgres://postgres:postgres@localhost:51214/template1?sslmode=disable&connection_limit=10&connect_timeout=0&max_idle_connection_lifetime=0&pool_timeout=0&socket_timeout=0"
   SHADOW_DATABASE_URL="postgres://postgres:postgres@localhost:51215/template1?sslmode=disable&connection_limit=10&connect_timeout=0&max_idle_connection_lifetime=0&pool_timeout=0&socket_timeout=0"

🐘 You can also use the DATABASE_URL with the pg or postgres.js JavaScript drivers as well as your favorite DB gui.

   For the best experience, set the maximum number of connections to 10, connect timeout to 0 and
   idle timeout to the smallest positive value supported.

🌊 Prisma Streams is available at:

   PRISMA_STREAM_URL="http://127.0.0.1:51216/v1/stream/prisma-wal"

┌─────────────────┐
│ Press q to quit │
└─────────────────┘

Note that this is different from the docs.

I'm not able to complete Step 2. I'm using the same project as that from the Quickstart, with the exception of changing the .env DATABASE_URL to that from Step 1.

Here's the console:

$ pnpm dlx prisma migrate dev            
Loaded Prisma config from prisma.config.ts.

Prisma schema loaded from prisma/schema.prisma.
Datasource "db": PostgreSQL database "template1", schema "public" at "localhost:51214"

Error: P1017
                                    Server has closed the connection.   ```
#

I listed the running database:

$ pnpm dlx prisma dev ls               
Loaded Prisma config from prisma.config.ts.

 name     status   urls                                                                                                                                                                        
 default  running  DATABASE_URL:                                                
                   prisma+postgres://localhost:51213/?api_key=eyJk...AifQ 
                   STREAM: http://127.0.0.1:51216/v1/stream/prisma- 
                   wal                                                    
                   TCP:                                                         
                   postgres://...@localhost:51214/... 
                   Terminal: ...psql -h       
                   localhost -p 51214 ...                           

Any idea of what to try next?

terse dew
#

reping

robust estuary
#

Are you on MacOS or Windows? Do you have any VPN on or any networking software that interferes with local bridges?

terse dew
#

Thanks for the response. macOS Ventura 13.7.8. VPN is off. No other software that could interfere of which I know.

#

Are there any troubleshooting tips I can try?

robust estuary
#

Could try and connect using a local client like Beekeeper Studio to see if the server allows regular Postgres connections, always worth a quick spin up and down too to see if that solves it

terse dew
#

Yeah, I tried that as well, but my client would not connect. DataGrip, or its equivalent in PyCharm.

#

I could also try a PG instance in Docker I have running for a non-Prisma project.

#

But I don't know whether that would lose any benefit of Prisma ORM stuff.

cobalt pumice
# terse dew I successfully completed the Quickstart for Prisma Postgres at https://www.prism...

It sounds to me like your prisma dev is out out date.
Can you check your dev version please?

pnpm dlx prisma --version

Using local and dev, it sounds like your url is wrong.

DATABASE_URL="prisma+postgres://localhost:51213/?api_key=__API_KEY__"

Then if its out of date, update it with:

pnpm add -D prisma@latest @prisma/client@latest

Check your version again.
Then you need to run pnpm dlx prisma dev and this time hit h to get the new URL.
If these two commands run correctly, you should be able to migrate.

prisma migrate dev
terse dew
# cobalt pumice It sounds to me like your prisma dev is out out date. Can you check your dev ver...

Thanks for the tip. It appears to be current, v7.8.0. I installed it on May the Fourth (be with you hehe).

Prisma schema loaded from prisma/schema.prisma.
prisma               : 7.8.0
@prisma/client       : 7.8.0
Operating System     : darwin
Architecture         : arm64
Node.js              : v24.15.0
TypeScript           : unknown
Query Compiler       : enabled
PSL                  : @prisma/prisma-schema-wasm 7.8.0-6.3c6e192761c0362d496ed980de936e2f3cebcd3a
Schema Engine        : schema-engine-cli 3c6e192761c0362d496ed980de936e2f3cebcd3a (at ../../Library/Caches/pnpm/dlx/8b96e82ed7198c2bd4f4b575220ebeb232bf51e6b54cd352d9811fb6b861b66c/19e012ec58f-1782/node_modules/.pnpm/@[email protected]/node_modules/@prisma/engines/schema-engine-darwin-arm64)
Default Engines Hash : 3c6e192761c0362d496ed980de936e2f3cebcd3a
Studio               : 0.27.3

The URLs I got were those as I reported originally in #1501160844875268226 message from using the command pnpm dlx prisma dev. Note that my original post has only an option to hit q to quit. There's no option for h or t, as the docs claim.

I'll also open an issue in the documentation repo about the difference between what I see and what the docs say I should say.

terse dew