prisma: `prisma db pull` doesn't read `.env` file and errors with Environment variable not found: DATABASE_URL
Bug description
yarn prisma db pull report Environment variable not found: DATABASE_URL.
Prisma schema loaded from prisma/schema.prisma
Error: Get config: Schema Parsing P1012
error: Environment variable not found: DATABASE_URL.
--> schema.prisma:10
|
9 | provider = "postgresql"
10 | url = env("DATABASE_URL")
|
Validation Error Count: 1
.env: DATABASE_URL=“postgresql://user:pass@localhost:49154/db?schema=public”
How to reproduce
Expected behavior
read DATABASE_URL from .env correctly
Prisma information
Environment variables loaded from .env prisma : 3.9.0 @prisma/client : 3.9.0 Current platform : darwin-arm64 Query Engine (Node-API) : libquery-engine bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/libquery_engine-darwin-arm64.dylib.node) Migration Engine : migration-engine-cli bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/migration-engine-darwin-arm64) Introspection Engine : introspection-core bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/introspection-engine-darwin-arm64) Format Binary : prisma-fmt bcc2ff906db47790ee902e7bbc76d7ffb1893009 (at node_modules/@prisma/engines/prisma-fmt-darwin-arm64) Default Engines Hash : bcc2ff906db47790ee902e7bbc76d7ffb1893009 Studio : 0.457.0
Environment & setup
- OS: macOS 12.2
- Database: PostgreSQL 13
- Node.js version: v14.18.1
Prisma Version
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 8
- Comments: 16 (5 by maintainers)
Hey, this issue has been fixed in 3.9.1 which was just published. Thanks for reporting this!
Hi @smoothdvd
Thanks for the report!
I can confirm this is a regression, we are working on a fix and are planning a patch release later today 🚢
@smoothdvd @Jolg42 Remove the quote from your
.envfileSure,
Bug Description
yarn prisma db pull report Environment variable must start with the protocol
mysql://.env:Environment & setup OS: macOS 12.3.1 Database: MySQL 8.0.27 Node.js version: v14.17.3
DESCRIPTION
I start using prisma with nestjs, I have a folder name
prismawithschema.prismafile, when I executeyarn prisma db pullI have the error but when I replace the 7 line with the value of the env variable works fine:prisma/schema.primsmaPhew! Thought I was losing my mind. Confirmed I saw this in 3.9.0, and thankfully not in 3.9.2.
so you cant be specfic about how you did this. why talk in the first place …when you can’t explain to us how you fixed a problem.mtchew!
@jedstroke @janpio @Jolg42 Hi this issue comes back again in 5.9.1.
With or without the quote from my
.envfile. And I have double checked that there is only one.envfile in my project. I also removed the.env.localfile, so there is no any other versions of the.envfile. So no overwrite.Here is the link for the details: https://github.com/prisma/prisma/discussions/23000