Load environment variable in javascript

Hello,

I have created an environment variable in onrender-Dashboard. To access it in javascript-Script I have used the suggested code but seems to be not working. Any ideas how to solve it? Thanks!

Hi awadih,

Can you clarify if this JavaScript is running on the server or client side?

If you’re trying to get environment variables to the front end of a web service, you would need some server-side code to render that variable into your JavaScript file before including it in a response.

If this is server-side, it could help if you add some troubleshooting logs to inspect process.env and see if it matches your expectation.

Regards,

Matt