In Digital Oceans App Platform, we have added the env variables to the app level env settings and deployed the app:
But the env’s dont seem to be working.
In one of our main JS file we have console logged an env as follows:
This log returns the correct env locally both in build and dev mode. But in App Platform, it returns
undefined. So this suggests, the unique way in which App Platform handles env variables is not working with our set up (which I would have thought was pretty standard practice with a normal
.env file in the root and using dotenv
Does anyone know what else is needed to get Digital Oceans App Platform env variables to work correctly at runtime?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.
Click below to sign up and get $200 of credit to try our products over 60 days!