environment variables undefined in drizzle.config.ts
I have my config set up like this:
But when I try to run from my scripts, it throws my error designed to catch when is undefined. I can't figure out why it's coming up as undefined here though since it definitely does have a value, it even works when running migrations and such.
I used create-t3-app for this project btw
3 Replies
drizzle-kit doesn't automatically load values from
.env
for now, so you need to use the dotenv
package.Got it thanks
you can use dotenv-cli
https://www.npmjs.com/package/dotenv-cli
npm
dotenv-cli
A global executable to run applications with the ENV variables loaded by dotenv. Latest version: 7.3.0, last published: a month ago. Start using dotenv-cli in your project by running
npm i dotenv-cli
. There are 194 other projects in the npm registry using dotenv-cli.