invalid env variables
So Im using nextjs + drizzle + neon db
Ive setup a script to print my databse
i get this error:
`
here is my env.js:
https://gist.github.com/navincodesalot/e91d0cd5ffca574fe1a593ac48ae5311
Here is my server/index.ts:
https://gist.github.com/navincodesalot/bfda54ac39a0c5cdf88867fa3ad22eb5
Is there a reason I can't use process.env in my index.ts?
am I using it correctly
17 Replies
on dev or on prod?
but from the looks it it, its just not injecting the environment variables
you either didnt set them
or put a wrong file name
dev
my .env is set tho
same names and everything
Use .env.local to load environment variables
"Use .env.local to load environment variables"
https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#:~:text=Use%20.env.local%20to%20load%20environment%20variables
Configuring: Environment Variables | Next.js
Learn to add and access environment variables in your Next.js application.
whats the diff between .env and .env.local
is there a diff?
nextjs wants .local.env
¯\_(ツ)_/¯
damn alr ty
still getting that
changed it to .env.local
example
https://env.t3.gg/docs/nextjs#use-your-schema
these docs do the same thing
Env
Never build your apps with invalid environment variables again. Validate and transform your environment with the full power of Zod.
yo sorry for the ping do you have any idea?
its still doing that
is something wrong with t3-env?
is the issue with the environment or setting neon?
its in this file @nyx (Rustular DevRel)
you see where i do
env.DATABASE_URL!
my env.js:
https://gist.github.com/navincodesalot/e91d0cd5ffca574fe1a593ac48ae5311
my server/index.ts
https://gist.github.com/navincodesalot/bfda54ac39a0c5cdf88867fa3ad22eb5
@nyx (Rustular DevRel)
hey sorry to ping again but still confused do you got any idea?what is even the issue?
you ping me without saying
i cant help if you dont give me the error
sorry waht i mean is i still get invalid ENV variables @nyx (Rustular DevRel)
error ^
here is my env.js:
https://gist.github.com/navincodesalot/e91d0cd5ffca574fe1a593ac48ae5311
Here is my server/index.ts:
https://gist.github.com/navincodesalot/bfda54ac39a0c5cdf88867fa3ad22eb5
The error still the same
Nextjs isn’t reading the env file
If even after following the tutorial from their side it doesn’t work
Open a issue with them
Ok
Have you confirmed that a fresh t3 app is reading the env vars before you start fiddling with neon, etc? I noticed that, Lucia auth, for example, reads .env but nextjs wants .env.local. nextjs docs say they honor .env, but it just didn't work like that for me. I think incrementally introducing changes is the way to go
I mean idk. It’s just that the env.js isn’t working I guess