Hello Temesgen,
If your environment variables aren’t appearing in your deployed Azure Static Web App, it’s because they aren’t injected into the client-side code by default. Here’s how to resolve it:
- Use GitHub Secrets in Your Workflow: Set the environment variables as secrets in your GitHub repository and pass them to the build step.
- name: Build React App with Environment Variables env: REACT_APP_API_URL: ${{ secrets.REACT_APP_API_URL }} run: npm run build
- Add
REACT_APP_
Prefix: Ensure all environment variables start withREACT_APP_
for Create React App to recognize them. (https://create-react-app.dev/docs/adding-custom-environment-variables/)
This approach embeds the variables at build time, making them available in the app.
If the information helped address your question, please Accept the answer.
Luis