Which object holds environment variables (Nuxt)

I just configured & deployed a nuxt app to be deployed to cloudflare pages. Environment variables are all setup, but I can't seem to access them, like to setup my drizzle DB connexion : (I'm using t3-env to valdiate & access my env vars : https://env.t3.gg/)
// db/index.ts
import { neon, neonConfig } from '@neondatabase/serverless';
import { drizzle as drizzleNeon } from 'drizzle-orm/neon-http';
import * as schema from './schema';
import { env } from '@/server/env';

neonConfig.fetchConnectionCache = true;

export const db = drizzleNeon(neon(env.DATABASE_URL), { schema, logger: false });
// db/index.ts
import { neon, neonConfig } from '@neondatabase/serverless';
import { drizzle as drizzleNeon } from 'drizzle-orm/neon-http';
import * as schema from './schema';
import { env } from '@/server/env';

neonConfig.fetchConnectionCache = true;

export const db = drizzleNeon(neon(env.DATABASE_URL), { schema, logger: false });
// server/env.ts

export const env = createEnv({
server: {
APP_BASE_URL: z.string().url(),
APP_ENV: z.enum(['local', 'production']),
DATABASE_URL: z.string().url(),
DATABASE_SOURCE: z.enum(['neon', 'local']),
CLERK_WEBHOOK_SECRET_KEY: z.string(),
AWS_ACCESS_KEY_ID: z.string(),
AWS_SECRET_ACCESS_KEY: z.string(),
AWS_SES_REGION: z.string(),
AWS_SES_SOURCE_EMAIL: z.string(),
AWS_S3_REGION: z.string(),
AWS_S3_BUCKET: z.string(),
AWS_CLOUDFRONT_URL: z.string(),
MAX_USER_PER_ORG: z.string().transform((v) => parseInt(v, 10)),
},
});
// server/env.ts

export const env = createEnv({
server: {
APP_BASE_URL: z.string().url(),
APP_ENV: z.enum(['local', 'production']),
DATABASE_URL: z.string().url(),
DATABASE_SOURCE: z.enum(['neon', 'local']),
CLERK_WEBHOOK_SECRET_KEY: z.string(),
AWS_ACCESS_KEY_ID: z.string(),
AWS_SECRET_ACCESS_KEY: z.string(),
AWS_SES_REGION: z.string(),
AWS_SES_SOURCE_EMAIL: z.string(),
AWS_S3_REGION: z.string(),
AWS_S3_BUCKET: z.string(),
AWS_CLOUDFRONT_URL: z.string(),
MAX_USER_PER_ORG: z.string().transform((v) => parseInt(v, 10)),
},
});
All these env vars are alaways empty & validation fails. By default it looks into process.env, but I can change the lookup object. But I'm still not sure to understand how I can access these env vars. I tried looking into globalThis, process.env, import.meta.env but none of these objects seem to hold my env vars.
1 Reply
Want results from more Discord servers?
Add your server