I had the same issue as you did, except in my case, only one of three of my REACT_APP_*
variables was loading. I don't know why but as a workaround, I would avoid using REACT_APP_
prefixes, something more akin to the following:
const app_settings_vals = {
"host": {
"port": port,
"baseUri": baseUri,
"domainName": domainName,
"ver":"0.0.1"
},
"credentials": {
"clientId": process.env.AD_CLIENT_ID || "REPLACE-WITH-YOUR-APP-CLIENT-ID",
"tenantId": process.env.AD_TENANT_ID || "REPLACE-WITH-YOUR-APP-TENANT-ID",
"clientSecret": process.env.AD_CLIENT_ID_SECRET || "REPLACE-WITH-YOUR-APP-CLIENT-ID-SECRET"
},
"settings": {
"homePageRoute": "/home",
"redirectUri": `${baseUri}/redirect`,
"postLogoutRedirectUri": `${baseUri}/`
},
"resources": {
"graphAPI": {
"callingPageRoute": "/profile",
"endpoint": "https://graph.microsoft.com/v1.0/me",
"scopes": ["user.read"]
},
"armAPI": {
"callingPageRoute": "/tenant",
"endpoint": "https://management.azure.com/tenants?api-version=2020-01-01",
"scopes": ["https://management.azure.com/user_impersonation"]
}
}
}
console.log(JSON.stringify(app_settings_vals));
return app_settings_vals;
I found this sample at https://github.com/Azure-Samples/js-e2e-web-app-server-auth/blob/main/appSettings.js.