Question:
I have a simple React app where I’m trying to make a restful http call to an API with an env key. However, when I try and access it, I get a ReferenceError: process is not defined. Can I call process.env with a simple front end React app in replit?
As far as I understand, this is happening on the front-end. This means that you are using JavaScript NOT NodeJS and I believe process is a NodeJS variable.
I see. So given that I’ve built a FE only app at this point, where does Replit store this env key when I add it via the “Secrets” tool? And how can I alternatively retrieve it? (Replit recommends using process.env, but it must think I’m in a nodejs app instead of a React app. Strange, as this is a simple app created from their React template…)
As far as I’m aware, secrets are not properly available for the front-end, because anything front-end can be seen via the browser developer tools so no secret would actually be secret on the front-end. Secrets are intended for backend use.