Next.js Discord

Discord Forum

Next.js file not reading .env var

English Foxhound posted this in #help-forum
Open in Discord
English FoxhoundOP
I think I might have made a mistake somewhere with my next app
I keep trying to call some of my env files using process.env but I keep getting undefined
the TS file that calls the variable is located in the lib file
and the .env is located just in the main folder(outside the src file )

3 Replies

My first two things are always:

1) Is the .env.local file in the root?

2) Are you spelling your variable correctly? (I had someone who swore he was but ended up not so double check to be safe lol)

Also some of your env files? As in there are multiple? Ive never used multiple, could be an issue, dunno.
English FoxhoundOP
i meant some of the variaibles inside the 1 .env file
im using clerk and it seems to not have an issue
but when i try to call the aws( also using that) key's they keeps sending (undefined)
also the i just named the env file ".env"
as for the spelling
I still did a copy and paste of the names , just to avoid any Issues