Repl secret undefined

I was working on the freecodecamp ‘use the .env’ challenge using repl.
but i am unable to access my secret environment variable. console logging it gives undefined . if i try to console log process.env, there is not MESSAGE_STYLE property there.

Your project link(s)

solution: https://replit.com/@rishi611/boilerplate-express

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

Challenge: Use the .env File

Link to the challenge:

It seems to be working for me. Did you restart the Node server after setting the environment variable?

Note environment variables are always strings. So instead of 'uppercase' you can simply use uppercase.

1 Like

Oh now its working, i removed the ‘’, and then its getting console logged properly, there might be something to do with me the ’ character not getting escaped causing error in creating the key, maybe.
Thanks a lot for the help, i was stuck on this for quite some time now

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.