Next.js Discord

Discord Forum

I'm having trouble accessing my environmental variable in my .env.local file.

Unanswered
Masai Lion posted this in #help-forum
Open in Discord
Masai LionOP
It is currently in my src file:
pictured in project Structure
It is referenced in my mongodb.ts file:
pictured in ref1.
and it is defined in that .env.local file as MONGO, which should give my connection string.
(I've tried with and without quotations around the string, along with as a .env file and running in production and test servers
Please if you have any idea as to why this would be disregarding my .env.local file I'd really appreciate the help.

1 Reply

Masai LionOP
I fixed it, didn't add NEXT_PUBLIC_MONGO on the key.
it just posted into the DB correctly