Replies: 2 comments
-
|
This is almost certainly an Azure Pipelines variable expansion issue rather than a Vite bug. In Azure Pipelines YAML, A few things to check:
- script: pnpm run build
displayName: "Build frontend"
env:
VITE_AZURE_AD_CLIENT_ID: $(azureAdClientId)
VITE_AZURE_AD_AUTHORITY: $(azureAdAuthority)If
- script: |
echo "VITE_DEPLOYMENT_ENV=$VITE_DEPLOYMENT_ENV"
echo "VITE_AZURE_AD_CLIENT_ID length: ${#VITE_AZURE_AD_CLIENT_ID}"
pnpm run build
env:
VITE_DEPLOYMENT_ENV: ${{ parameters.environment }}
VITE_AZURE_AD_CLIENT_ID: $(azureAdClientId)
VITE_AZURE_AD_AUTHORITY: $(azureAdAuthority)Don't echo the actual value of secrets, but printing the length tells you if it's empty.
The fact that it works locally but not in CI strongly suggests the env vars simply aren't reaching the build process. Start with the debug step above to confirm. |
Beta Was this translation helpful? Give feedback.
-
|
The Vite docs make two things relevant here:
So if these values are really present in the process environment when env:
VITE_DEPLOYMENT_ENV: ...
VITE_AZURE_AD_CLIENT_ID: ...
VITE_AZURE_AD_AUTHORITY: ...then Vite should expose them. That makes this look more like a CI/env injection problem than a Vite env-loading problem. The quickest checks I would make are:
So my read is: if local works and CI does not, the likely issue is that Azure Pipelines is not passing the variables into the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Describe the bug
It seems that it isn't loading the environment variables
This bug happened again a few months ago in version 7.1.x—I don't remember exactly which one, but it was fixed, and then it came back
displayName: "Build frontend (${{ parameters.environment }})"
env:
NODE_OPTIONS: "--max-old-space-size=4096"
CI: true
LEFTHOOK: "false"
VITE_DEPLOYMENT_ENV: ${{ parameters.environment }}
VITE_AZURE_AD_CLIENT_ID: $(azureAdClientId)
VITE_AZURE_AD_AUTHORITY: $(azureAdAuthority)
Reproduction
Steps to reproduce
No response
System Info
Used Package Manager
pnpm
Logs
No response
Validations
Beta Was this translation helpful? Give feedback.
All reactions