Next.js Discord

Discord Forum

.env vars are not imported

Unanswered
Gouty oak gall posted this in #help-forum
Open in Discord
Gouty oak gallOP
when I run console.log(process.env), I get a list of variables, but when I run log process.DATABASE_URL I get undefined.

It was working fine in my prior project, but when I created another one with Drizzle instead of Prisma I got this issue.

How do I debug this?

next.config.js
await import("./src/env.js");
/** @type {import("next").NextConfig} */
const config = {};
export default config;

src/env.js (I log before createEnv since zod throws an error of validation)
import { createEnv } from "@t3-oss/env-nextjs";
import { z } from "zod";

console.log(process.env.DATABASE_URL);
export const env = createEnv({...});

0 Replies