Repository navigation
Prisma Postgres guide: pin to Prisma ORM 7 and fix broken v7 setup steps - #14664
Conversation
|
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉 Here’s what will happen next:
|
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
|
Preview deployment ✅ Deployment complete!
|
ArmandPhilippot
left a comment
There was a problem hiding this comment.
I reproduced the steps using a local DB, as I don't have an account either, and this looks accurate to me! Nice catch on dotenv.
I’m going to add a link to the open issue, as I think that’s enough to close it for now. Prisma 7 is still supported, and anyone is free to update the instructions for Prisma 8 once it becomes stable. There is no need to keep an issue open for this as long as everything is working.
Thanks for your help, and welcome to Docs contributors! 🥳
Description (required)
Interim fix. This pins the Prisma Postgres guide to Prisma ORM 7 so readers can follow it again. It does not migrate the guide to Prisma ORM 8, which #14605 prefers, because I could not get a clean Prisma 8 setup working today (details below). Happy to follow up with a v8 rewrite once that works.
Since
npm install prismanow resolves to8.0.0-rc.19(thelatesttag), the guide fails at step 2. While checking it against Prisma 7, I found it was also broken there:prisma@7,@prisma/client@7,@prisma/adapter-pg@7prisma init(v7) writesprisma7.config.ts, which doesimport "dotenv/config"; withoutdotenvevery later command fails withCannot find module 'dotenv/config'dotenvto dev dependenciesprisma7.config.tsurl = env("DATABASE_URL")fails on 7.10 with P1012: "The datasource propertyurlis no longer supported in schema files"prisma7.config.ts); update theinshighlight rangemigrate devalso generates the client; it no longer does in v7Testing (Prisma 7.10.0, Astro 7.3.5,
@astrojs/nodestandalone, Node 22, PostgreSQL 17):In a new
create astrominimal project, I ran every command from the edited guide and copied the schema,src/lib/prisma.ts, andsrc/pages/posts.astroblocks from the edited file without changes.npx prisma generate→✔ Generated Prisma Client (7.10.0) to ./prisma/generatednpx prisma migrate dev --name init→ migration created and appliedastro build→ complete;GET /postson the built server rendered the published post and excluded an unpublished one.url = env("DATABASE_URL")line reproduces the P1012 error.One step was not tested end to end:
prisma init --dbprovisions a hosted database and requires a Prisma account, so I used a local PostgreSQL instance andprisma init --output ./generated. I confirmed that--dbexists in 7.10.0 (prisma init --help).Why not Prisma 8 yet: with
prisma@latest(8.0.0-rc.19),prisma orm init --target postgres --authoring pslinstalls@prisma/orm-postgres@8.0.0-rc.14(itslatesttag), with unresolved peer dependency warnings for@prisma/cli-engine. After that,prisma contract emitfails withCONTRACT.PACK_CONTRIBUTION_INVALID("Malformed authoring pslBlock contribution"). I got the same result withprisma@nextand with matching versions. Because of that, I could not write v8 instructions I had verified. Prisma lists v8 as a release candidate until its final release, planned for October, so a v8 rewrite seems better after that.References