React app REACT_APP_ env variables always undefined

Hello everyone, I have a simple setup, trying to add IS_STAGING env variable to my app and I did as following

I added an environment variable named REACT_APP_IS_STAGING with the value of true, but it’s not getting picked up

But this gives me undefined

console.log(process.env.REACT_APP_IS_STAGING);

My app is rather simplistic, created with create-react-app

image

Of course, that type of variable namespace will only work in case you are actually building a react app; I suppose you are :slight_smile:

If so, it seems likely that your build pipeline somehow ignores your env vars in subprocesses, since that should be set both during build, and after deploy. I wrote an explanation of why this could happen, how to troubleshoot and fix; check out this article but especially the third paragraph for advice that is likely relevant to you: