You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- [ ] bug report -> please search issues before submitting
- [ ] feature request
- [ ] documentation issue or request
- [x] regression (a behavior that used to work and stopped in a new release)
Minimal steps to reproduce
Add some frontend code that is using VITE_* environment variable
Run start.sh script
Observe that VITE_* values are empty
Any log messages given by the failure
none
Expected/desired behavior
start.sh script used to import environment variables from azd environment at the beginning. It would be nice to be able to load env values before starting frontend. start.ps1 doesn't have this problem.
OS and Version?
Linux Ubuntu 22.04
azd version?
1.11.0
Mention any other details that might be useful
I realize that this behavior is impacting only a customization that I've made in my fork. We are using a few VITE_* variables to change some UI elements depending on the environment we run the application in.
The start.sh change was made in PR #1986 to remove an anti-pattern. I'm not asking to revert it, but maybe you can suggest how to load specific environment variables before starting the frontend?
Or maybe I'm doing it wrong and should not rely on VITE_* variables at all.
Thanks!
The text was updated successfully, but these errors were encountered:
Hm, were you setting those VITE_ variables using azd env set or export? If you're setting them via export, then they should keep working fine. I only expected devs to be setting azd-related variables via azd env set.
Another thing you may want to do, if you're using VS Code, is to use the VS Code run & debug instead, and add those VITE variables in .vscode/launch.json. I personally avoid using the start scripts, since they're fairly slow to start, don't do hot reloading, etc.
I set them with azd env set and also put them into a bicep file for pushing into an app service.
I haven't used VS Code run & debug option, but isn't .vscode/launch.json going to remain the same when I switch azd env? My use case is to have different VITE environment values for different azd env
For now I've just restored the code for env variables in start.sh, but added a filter to do export only of VITE variables
Ah, okay, I didn't appreciate that you used them for deployment and vary them per environment.
If you want to send a PR for your vite change, we could make that change in the main branch as well. That's reasonable that you need access to VITE_ variables in the frontend.
This issue is for a: (mark with an
x
)Minimal steps to reproduce
start.sh
scriptAny log messages given by the failure
none
Expected/desired behavior
start.sh
script used to import environment variables from azd environment at the beginning. It would be nice to be able to load env values before starting frontend.start.ps1
doesn't have this problem.OS and Version?
Linux Ubuntu 22.04
azd version?
1.11.0
Mention any other details that might be useful
I realize that this behavior is impacting only a customization that I've made in my fork. We are using a few VITE_* variables to change some UI elements depending on the environment we run the application in.
The
start.sh
change was made in PR #1986 to remove an anti-pattern. I'm not asking to revert it, but maybe you can suggest how to load specific environment variables before starting the frontend?Or maybe I'm doing it wrong and should not rely on VITE_* variables at all.
Thanks!
The text was updated successfully, but these errors were encountered: