Skip to content

Start.sh doesn't pre-load environment variables anymore - this breaks automatic VITE_* environment variables in frontend #2227

@egor-yudkin

Description

@egor-yudkin

This issue is for a: (mark with an x)

- [ ] 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

  1. Add some frontend code that is using VITE_* environment variable
  2. Run start.sh script
  3. 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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions