Drizzle TeamDT
Drizzle Team3y ago
6 replies
Dayblox

URL_INVALID

The env variables are defined when using bun run push but not when using npm run push or pnpm run push, resulting in LibsqlError: URL_INVALID: The URL is not in a valid format because url is undefined?authToken=undefined

export default {
  schema: "./src/db/schema.ts",
  out: "./src/db/migrations",
  driver: "libsql",
  dbCredentials: {
    url: `${process.env.DATABASE_URL}?authToken=${process.env.DATABASE_TOKEN}`,
  },
} satisfies Config

{
  "scripts": {
    "push": "drizzle-kit push:sqlite"
  },
  // ...
}
Solution
bun parsed the
.env
file automatically but node does not. You need you use dotenv or something similar when using pnpm/npm/yarn
Was this page helpful?