Why my front can't access to .env ?
Answered
Awakno posted this in #help-forum
AwaknoOP
Hi, I want to create a Admin Page for my website, but when I do a condition to check if good email, process.env.admin_mail return undefined ?
Anyone know why ?
Anyone know why ?
Answered by B33fb0n3
you can't access your serverside only env variables on the clientside.
You can create a .env file and add your public variable there with
You can create a .env file and add your public variable there with
NEXT_PUBLIC_YOUR_ENV=12345
. After that you are able to access it on the clientside3 Replies
@Awakno Hi, I want to create a Admin Page for my website, but when I do a condition to check if good email, process.env.admin_mail return undefined ?
Anyone know why ?
you can't access your serverside only env variables on the clientside.
You can create a .env file and add your public variable there with
You can create a .env file and add your public variable there with
NEXT_PUBLIC_YOUR_ENV=12345
. After that you are able to access it on the clientsideAnswer
AwaknoOP
Oh ok thx
happy to help