#Can't get Prisma migrate to read my env variables

3 messages · Page 1 of 1 (latest)

cinder jewel
#

I have my project connected to vercel and on that project I connected a postgres db. I did a Vercel Pull and I have all my env variables into .env.development.local. I have created a schema.prisma file as following:

// schema.prisma

generator client {
    provider = "prisma-client-js"
}

datasource db {
    provider  = "postgresql"
    url       = env("POSTGRES_PRISMA_URL") // uses connection pooling
    directUrl = env("POSTGRES_URL_NON_POOLING") // uses a direct connection
}

... Model definitions below ...

When I do "npx prisma migrate dev" I get the error "Environment variable not found: POSTGRES_PRISMA_URL."

However that variable is set in the .env.development.local file as POSTGRES_PRISMA_URL="<THE URL HERE>".

I have no idea. I have also tried pasting the env variables in .env.local as well but I get the same error.

(Btw, when I print my env variables in my code they get displayed correctly. When I do "echo %POSTGRES_PRISMA_URL%" in CMD I get nothing displayed)

worldly pathBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)

cinder jewel
#

Apparently there is an issue with Prisma only reading from the .env file and no other env file (such as .env.local or .env.development.local etc.)

There is a relevant issue opened here https://github.com/prisma/prisma/issues/11050

GitHub

Problem The Prisma documentation suggests using multiple .env files to separate configuration between different environments (for instance, connecting to different databases for local development v...