P
Prisma3w ago
pedro

Help. Prisma ORM is not loading environment variables

When I run db:deploy. It always errors saying DATABASE_URL was not found if the DATABASE_URL is not present on a .env file. I've run echo $DATABASE_URL it returns postgres://pos... (the correct DATABASE_URL). If this same DATABASE_URL is present on a .env file. It works correctly. I'm using the folder schemas, so I tried to make the schema path explicit like this:" "db:deploy": "prisma migrate deploy --schema ./prisma/schema" But this also fails
4 Replies
pedro
pedroOP3w ago
Temporary fixed it by manually generating the .env file so prisma can read it. In case anyone has the same issue in the futuro until a PR is merged.
[deploy]
release_command = "echo \"DATABASE_URL=\\\"$DATABASE_URL\\\"\" > ./packages/db/.env && bunx turbo run --filter @diet-it/db db:deploy"
[deploy]
release_command = "echo \"DATABASE_URL=\\\"$DATABASE_URL\\\"\" > ./packages/db/.env && bunx turbo run --filter @diet-it/db db:deploy"
Nurul
Nurul3w ago
Hello @pedro 👋 Was this happening on latest prisma version 5.21.1?
pedro
pedroOP3w ago
Hey, Nurul. Yes, it is. Due to my deployment environment the above solution was the only one I could find. I plan on making reproduction repo and a issue on Github, I just don't have the time for it right now as we have a tight deadline for December in our company. I can do the triage as well to be sure it's not related to a specific runtime, package manager, environment, etc. I got this conclusion in a pretty rushed environment so take it with a grain of salt.
Nurul
Nurul3w ago
A minimal reproduction repository would be great! Please let me know once you do, I'll share that internally with our ORM team 🙏
Want results from more Discord servers?
Add your server