Replit Secrets within JavaScript Not Working

When I define my variable as shown below :arrow_down_small:

const API_KEY = procces.env.API_KEY;

returns the following error: Uncaught ReferenceError: procces is not defined in the console

It seems that this is categorized withing HTML/CSS/JS, meaning that this is an HTML project?

In that case, secrets don’t work, you’ll have to make a Node.js project if you want secrets to work.

1 Like

Ok. If so, how should I keep my API key a secret?


In HTML/CSS/JS, I don’t think you can.

You can try base64-encoding it with btoa() and decoding it with atob(), but it can be easily broken. Other than that, I don’t think there’s a way.


You misspelled process both times, is that why?

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