Open pcanas opened 1 year ago
+1
+1
+1
I'm wondering if there is a difference with backend and frontend. Banckend runs in an Azure Function afaik. Maybe only backend knows about the ENV variables? Just guessing here.
Edit: passing env via the Azure/static-web-apps-deploy@v1
task did work for my Nuxt app. took me a long time to get it working though.
Things like React, Vite, Nuxt etc need the env variables at build time. So you need to specify it in the GH account, and not the Azure portal.
Maybe the fix for the OP @pcanas is that react needs to REACT_
prefix? This is the case for Vite (VITE_
) and Nuxt (NUXT_
).
env: # Add environment variables here
REACT_PPP: ppp
So it's not a bug. But more documentation or guidance that is lacking.
I would like to pass a custom environment variable to be by my React-based PWA. So far, this is how the app looks:
I followed this tutorial and try to add
CUSTOM_ENV
andPPP
in 2 different ways:CUSTOM_ENV
was added as an environment variable from the Azure Portal:PPP
was added from my Github Action:None of the methods work, as you can see from the following screenshot,
process.env
does not contain neither variable:Am I missing anything? How can I pass custom environment variables?