-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Root .env
variables aren't available to prisma in monorepo
#12535
Comments
I can reproduce your original issue but npm + env-cmd seem to work for me, with either:
This is gross though, either way. Would be nice to be able to configure prisma and tell it where to find the .env file, since the current options don't work great for a monorepo, as you said. |
FWIW dotenv-cli also worked for me. My package.json script is:
And then:
|
Why can't this work out of the box? Also the docs are kinda misleading:
In a monorepo, the root of the project is the monorepo root. It makes sense to traverse up until the root of the monorepo. |
Related example: https://github.com/vercel/turborepo/tree/main/examples/with-prisma |
Awesome @leerob although I see you're using symlinks to fix the " |
Any update on this guys? |
up, having the same issue |
Bug description
We have a monorepo using turbo repo with the following structure:
The prisma package is being used in multiple applications, currently we're trying to use a single
.env
to avoid confusion. Moving theDATABASE_URL
url frompackages/prisma/.env
to the root.env
errors when trying to run anyyarn prisma script
.We also tried to use a solution like
cmd-env
:But no luck so far.
How to reproduce
.env
file at the rootpackages/prisma
in a monorepo packageDATABASE_URL
in the root.env
file.yarn prisma
command.Expected behavior
Being able to use the monorepo
DATABASE_URL
without having to set it up inpackages/prisma/.env
.Prisma information
https://github.com/calcom/cal.com/blob/main/packages/prisma/schema.prisma
Environment & setup
Prisma Version
The text was updated successfully, but these errors were encountered: