How do I access .env variable using Glitch?

I start a new project on glitch.com, and add a variable and value in .env

Plaintext shows: SECRET=beNice (no quotes)

console.log(process.env.SECRET) shows: process is not defined

How can I call these variables?

You’re currently trying to access process.env with client-side code. process.env can only be accessed from server-side code.

Have a read of this thread for more.

4 Likes