Skip to content Skip to sidebar Skip to footer

I Am Unable To Read Environment Variable From Azure App Service Configuration From My React App

I have added my variable in the azure app service configuration and try to read it from my React project but I get undefined every time. Azure App Service :- https://i.stack.imgur.

Solution 1:

You can't get appsettings in azure app service configuration.

The React client side project essentially downloads a piece of code to run on the client browser, and will not be related to azure application settings. So its process.env cannot read any azure environment variables.

But you can create .env file in your project. Then you can get environment variable by process.env.REACT_APP_PREVIEWMODE. ( I have test it under windows platform. )

For more details, please read answer in below posts.

1. 404 Error when trying to fetch json file from public folder in deployed create-react-app

2. Azure WebApps React: the environment variables exist but are not present when I call process.env

Post a Comment for "I Am Unable To Read Environment Variable From Azure App Service Configuration From My React App"