Unable to use ENV locally
Answered
Caya posted this in #help-forum
CayaOP
So i want to use some API which have some key so before implement it directly i wanted to use env for testing cuz i never used vercel's env before so i have a key and value in
.env.local folder NEXT_PUBLIC_TESTING_VERCEL_ENV="testing" but when i try to console.log it in my project it gives me value as UNDEFINED so can someone help me with thisAnswered by Toyger
should work.
did you try to restart dev server?
can you try to put some different
did you try to restart dev server?
can you try to put some different
NEXT_PUBLIC_ variable into .env file, and console.log it, to understand will it work at least somehow.7 Replies
Toyger
.env.local folderfolder? it should be file
can you also show code how you access it for console.log
@Toyger > .env.local folder
folder? it should be file
can you also show code how you access it for console.log
CayaOP
yeap its a file in root dir
export const Projects = () => {
console.log(process.env.NEXT_PUBLIC_TESTING_VERCEL_ENV);
return (
// rest of the code\@Caya yeap its a file in root dir
js
export const Projects = () => {
console.log(process.env.NEXT_PUBLIC_TESTING_VERCEL_ENV);
return (
// rest of the code
\
Toyger
should work.
did you try to restart dev server?
can you try to put some different
did you try to restart dev server?
can you try to put some different
NEXT_PUBLIC_ variable into .env file, and console.log it, to understand will it work at least somehow.Answer
@Toyger should work.
did you try to restart dev server?
can you try to put some different `NEXT_PUBLIC_` variable into `.env` file, and console.log it, to understand will it work at least somehow.
CayaOP
nope i haven't restated the dev server let me do that as well as let me try to console.log other variable too
@Toyger should work.
did you try to restart dev server?
can you try to put some different `NEXT_PUBLIC_` variable into `.env` file, and console.log it, to understand will it work at least somehow.
CayaOP
Hey thanks it worked i just restated the dev server and it worked lol
btw its consolelog that variable twice you know ehy?
btw its consolelog that variable twice you know ehy?