Tokens from `.env` are not loaded into `app` folder
Answered
Chinese softshell turtle posted this in #help-forum
Chinese softshell turtleOP
I have project: https://github.com/kuskusapp/kuskus
I put my env variables in root
then i try log
I put my env variables in root
.envthen i try log
console.log(process.env.HUGGINGFACE_TOKEN, "token"), its undefinedAnswered by Chinese softshell turtle
useEffect(() => {
console.log(process.env.NEXT_PUBLIC_HUGGINGFACE_TOKEN, "token")
}, [])10 Replies
Chinese softshell turtleOP
https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
docs say it should work
docs say it should work
is this how you do it with
app folder?none of these tokens are being read right now in root
my env is fully empty now
Chinese softshell turtleOP
tried to do this
still
env is emptyChinese softshell turtleOP
useEffect(() => {
console.log(process.env.NEXT_PUBLIC_HUGGINGFACE_TOKEN, "token")
}, [])Answer
Chinese softshell turtleOP
ok this works