Drizzle Studio not working with bun

I had a basic project running with pnpm, then switched to bun and removed the dotenv package and its imports in /drizzle.config.ts. Now when I run bun drizzle-kit studio I get this error: /drizzle/drizzle.config.json file does not exist Previously it didn't look in the /drizzle folder for the config file, and automatically detected that my config was in root and ended with a .ts extension. If I run bun drizzle-kit studio --config ../drizzle.config.ts it picks up the config file, but I get this error:
Invalid input "url" is a required option for driver "turso". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference
Invalid input "authToken" is a required option for driver "turso". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference
error: "drizzle-kit" exited with code 1
Invalid input "url" is a required option for driver "turso". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference
Invalid input "authToken" is a required option for driver "turso". You can read more about drizzle.config: https://orm.drizzle.team/kit-docs/config-reference
error: "drizzle-kit" exited with code 1
Here's my drizzle.config.ts:
import type { Config } from "drizzle-kit"

export default {
schema: "./drizzle/schema.ts",
out: "./drizzle/migrations",
driver: "turso",
dbCredentials: {
url: process.env.LOCAL_DATABASE_URL as string,
authToken: process.env.LOCAL_DATABASE_AUTH_TOKEN as string
},
// Print all statements
verbose: true,
// Always ask for confirmation, even they aren't breaking
strict: true,
// Execute every migration statement individually
breakpoints: true
} satisfies Config
import type { Config } from "drizzle-kit"

export default {
schema: "./drizzle/schema.ts",
out: "./drizzle/migrations",
driver: "turso",
dbCredentials: {
url: process.env.LOCAL_DATABASE_URL as string,
authToken: process.env.LOCAL_DATABASE_AUTH_TOKEN as string
},
// Print all statements
verbose: true,
// Always ask for confirmation, even they aren't breaking
strict: true,
// Execute every migration statement individually
breakpoints: true
} satisfies Config
The one change I've made to my config file is that I removed the dotenv package that I previously used (when still using pnpm/node). It seems that drizzle studio isn't picking up the env variables via bun. Is this intentional behaviour? How should I resolve this? Thanks!
1 Reply
Budi
Budi9mo ago
I was able to get this working after installing dotenv again and calling dotenv.config() in my drizzle.config.ts file. Any way to do without dotenv?
Want results from more Discord servers?
Add your server