Database url is mission
hi i am facing same issue just like this and the instruction is give by bot it's already done expect npm install dotenv and after doing last step still i am facing some issue
https://discord.com/channels/937751382725886062/1431070857253490688
and i am facing this issue when i run this comman
3 Replies
You chose to compile with the bot. One moment while I piece together your answer…
It looks like you are using a prisma.config.ts file with the new Prisma config format. When using this approach, Prisma does not automatically load environment variables from your
With the new Prisma config, environment variables from
- Add
.env file. You must explicitly load them using the dotenv package.
Steps to fix:
1. Install dotenv if you haven't:
2. Import dotenv/config at the top of your prisma.config.ts:
This ensures that process.env.DATABASE_URL is available when Prisma runs.
3. Make sure your .env file is in your project root (or wherever your config expects), and that it contains:
Why this is needed:With the new Prisma config, environment variables from
.env files are not loaded automatically. You must use dotenv to load them yourself. This is documented behavior and a common stumbling block when migrating to the new config system see here and here.
Summary:- Add
import "dotenv/config"; to your prisma.config.ts.
- Ensure your .env file is correct and in the right place.
- Then run your Prisma CLI commands again.
If you still see the error, double-check the spelling and path of your .env file, and make sure DATABASE_URL is set correctly (no extra spaces, colons, or typos) see example.
Let me know if you need more help!Add
import "dotenv/config" on top of prisma.config.tdthanks it work