${process.env.KEY} dont work

my ${process.env.KEY} dont work

React env variables have to start with REACT_ I believe. So you need to rename it REACT_KEY both there and in your .env file.

EDIT: Also, I notice that your .env file is not grey, which means it is being backed up to your git repo. You need to make sure to ignore it so you don’t expose your keys on accident.

EDIT AGAIN: ah, the poster before me looked it up. It’s REACT_APP, not REACT_. Almost had it! I don’t define a lot of new react ENV variables, apparently :wink:

From Create React App docs:

You must create custom environment variables beginning with REACT_APP_ . Any other variables except NODE_ENV will be ignored to avoid accidentally exposing a private key on the machine that could have the same name.

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