This was resolved by appending 'GATSBY_' to the front of the environment variables to ensure that it's exposed to the browser.
Runtime API Request to 3rd party DB service is being sent as 'Same Origin' on Static Web App
To illustrate the problem, please see the differences in request headers been app running on localhost and on Azure Static Web App service.
On Localhost:
On Azure Static Web Apps Service:
Other Info
The environment variables locally is held in '.env' while on Azure these were on GitHub secrets and referenced under the 'env:' section of the Actions workflow file. There is another API that is referenced in the same way and that works fine, but the working API is called at build time, while the problematic API is called on runtime I suspect.
So, to see if it will resolve this, for the runtime environment variables, I now specify these under Application Settings.
This still has not resolved the issue
2 answers
Sort by: Most helpful
-
-
Ali Sufyan Butt 86 Reputation points MVP
2023-04-13T12:21:35.3533333+00:00 Hi, Have you tried to manually amending the environment variables. Sometimes, the settings needs to be explicitly defined