Warning: consolidate your env vars
Hi developers, I am new to prisma and started enjoying it, the whole ecosystem is amazing, however since i am new, started facing some initial hiccups.
I just have a single .env file in my root directory, but whenever i get any prisma issue, it also put a warning with a code snippet, seems like not everyone is facing this and hence couldn't find much details online. may be its my tech stack :shrug: (Hono + Bun + Prisma)
Can someone please guide me how to get rid of this.
here is the warning:
Thanks for your guidance in advance!
2 Replies
You've gone full bot mode! Let me fetch that AI answer for you ASAP.
It sounds like you're seeing a Prisma warning about consolidating your environment variables, even though you only have a single
.env
file in your project root. This warning typically appears when Prisma detects conflicting environment variables in multiple .env
files (for example, one in your root and another in ./prisma
), or if it thinks there are duplicate variables being loaded from different locations.
What triggers this warning?
Prisma CLI looks for .env
files in several locations, in this order:
1. Project root (./.env
)
2. The same folder as your Prisma schema (e.g., ./prisma/.env
)
3. Other schema-specified locations
If the same variable (like DATABASE_URL
) is defined in more than one of these files, Prisma will warn you and suggest consolidating them into a single .env
file in your project root. This is to avoid confusion and potential conflicts about which value is used Managing Prisma ORM environment variables and settings.
How to resolve it:
- Make sure you only have one .env
file, ideally in your project root.
- Remove any .env
files from the prisma
directory or elsewhere in your project.
- If you use symlinks or tools that generate .env
files in multiple places, ensure only one is present at runtime.
If you still see the warning:
- Double-check for hidden or symlinked .env
files.
- Some users in monorepos or with certain setups (like symlinks or automated tools) have reported similar issues. In those cases, Prisma may still detect multiple .env
files even if you think there’s only one Provide a way to disable env conflicts warning.
Suppressing the warning:
You can set the environment variable PRISMA_DISABLE_WARNINGS=1
to suppress all Prisma CLI warnings, including this one Provide a way to disable conflict for env vars
w
arning.
If you continue to have issues, please check for any .env
files in subdirectories or symlinked locations, and ensure your tooling isn’t generating extra .env
files at build or runtime.
🤔 Alright, thanks for letting us know that there's still some help needed. A team member will reply to you shortly.
In the meantime, please let us know any additional info, questions, or which parts of the answer may need clarification.Can you set
PRISMA_DISABLE_WARNINGS=1
as environment variable and see if you still get the same warning?