env variable is undefined

Hi people,

I'm having issue that my env variables in config.drizzle.ts are being undefined, even though they exist in my .env file, If i try to hardcode them, they work fine.

if I try to console log them in server component they have expected value

import type { Config } from "drizzle-kit";

export default {
  schema: "./src/server/db/schema.ts",
  out: "migrations",
  driver: "pg",
  breakpoints: true,
  dbCredentials: {
    host: process.env.DB_HOST || "",
    port: 5432,
    ssl: true,
    database: process.env.DB_NAME || "",
    user: process.env.DB_USER || "",
    password: process.env.DB_PASSWORD || "",
  },
} satisfies Config;
Was this page helpful?