3

My situation is the following:

Vite-based development environment. React.js frontend-only web site; deployed to Azure SWA successfully. I have included an instance of Google Maps JavaScript API as well as a user form which uses EmailJS to send an email with the form data upon submission, all without a backend. Simple enough. It all works locally, the web site shows up with Azure just fine.

What I'm having trouble with is getting my environment variables to pass through their values when I declare them in Azure's Configuration settings page. See below:

enter image description here

I have tried variable names with and without VITE_* prefix just to cover my bases but the result is still the same: I get undefined when I console log the value right before its usage in my React components. See below:

enter image description here

What am I doing wrong or not understanding?

jcomp_03
  • 127
  • 1
  • 8
  • 1
    Having the same issue here – Igor Dragushhak May 11 '23 at 12:51
  • I cannot for the life of me read my env vars when deploying to azure. send help. tried both adding them to the Portal and also followed: https://learn.microsoft.com/en-us/azure/static-web-apps/build-configuration?tabs=github-actions#environment-variables no go... – tenwest May 18 '23 at 13:08

0 Answers0