drizzle-kit overriding `process.env` before `@next/env` can load values

I'm trying to use drizzle-kit push using the setup recommended by the Drizzle and Vercel docs, but I am finding that the drizzle-kit command is performing its own dotenv loading before my config file can import and use loadEnvConfig from @next/env. This is causing issues if I have an empty value for POSTGRES_URL in
.env
(for documentation purposes) and the actual value in .env.local (for local development) because drizzle-kit is unaware of how @next/env loads environment variables.

I've worked around this issue by setting by setting DOTENV_CONFIG_PATH=/dev/null, but there should a way to turn this automatic behavior off (or more ideally, make it opt-in instead of opt-out) so it is easier to load environment variables correctly using @next/env or another
.env
loader of choice.
Drizzle ORM is a lightweight and performant TypeScript ORM with developer experience in mind.
Learn how to use your favorite ORM to access your database from your apps
Was this page helpful?