Drizzle kit - Invalid environment variables

Hi, when trying to run " npx drizzle-kit introspect:pg", I get this error:
drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

No config path provided, using default path
Reading config file 'C:\Users\benca\Desktop\mylifts-v2\drizzle.config.ts'
❌ Invalid environment variables: {
DATABASE_URL: [ 'Required' ],
GOOGLE_CLIENT_ID: [ 'Required' ],
GOOGLE_CLIENT_SECRET: [ 'Required' ]
}
C:\Users\benca\Desktop\mylifts-v2\node_modules\@t3-oss\core\index.ts:243
!prop.startsWith(opts.clientPrefix) &&
^


Error: Invalid environment variables
}
drizzle-kit: v0.19.13
drizzle-orm: v0.28.6

No config path provided, using default path
Reading config file 'C:\Users\benca\Desktop\mylifts-v2\drizzle.config.ts'
❌ Invalid environment variables: {
DATABASE_URL: [ 'Required' ],
GOOGLE_CLIENT_ID: [ 'Required' ],
GOOGLE_CLIENT_SECRET: [ 'Required' ]
}
C:\Users\benca\Desktop\mylifts-v2\node_modules\@t3-oss\core\index.ts:243
!prop.startsWith(opts.clientPrefix) &&
^


Error: Invalid environment variables
}
My .env file is populated with these values and the schema in my env.js file has been updated accordingly too. So far the only way I've been able to get introspect or generate to run is by bypassing the t3 env validation and reading the variables with dotenv. Has anyone else run into this or know how to fix it?
1 Reply
kgb4861
kgb48616mo ago
I fixed this with 2 lines in your src/env.js put import { config } from "dotenv"; then config();