I have a React app deployed on Vercel.
It was working perfectly fine and I am not sure when this problem started to manifest itself.
I am confident that environmental variables are not deployed.
I tried to redeploy and to remove and re-add the variables from the dashboard but it didn’t make the trick.
As I am using Vite I am prefixing all variables name with VITE_.
Again this was working just fine until a while ago.
I saw some old discussions about this on github. Maybe a reoccurring issue?
Current: environmental variables are not readable in code.
Expected: environmental variables are readable
Use whatever app has environmental variables
Add the variables in the dashboard
Deploy and verify if env variables have been added
Deployment URL or Custom Domain:
Environment (local, preview, production):
Project Framework:
Build Settings:
Framework Preset:
Build Command (if not default):
Output Directory (if not default):
Install Command (if not default):
Node/Runtime Version:
Package Manager:
Relevant Packages:
It requires the following environmental variables
VITE_XP_BAR_INCREMENT=5
VITE_XP_BAR_DELAY=100
VITE_XP_BAR_RADIUS=50
VITE_XP_BAR_ANIMATE=false
VITE_GPT_BRIDGE_URL= <some_url>
The most evident bit that shows the lack of env variables are
src/lib/layout/index.tsx
{import.meta.env.VITE_GPT_BRIDGE_URL && }2) The progess bars in the
This should include a button with ChatGPT logo in the lower right corner, but it is not rendered as VITE_GPT_BRIDGE_URL is empty.
You can run locally with: pnpm dev
In local it works just fine, but not once deployed with correct variables in the project settings.
I realise is not a minimal repo and I apologise, but today I won’t have time to build one.
If this is not suitable for investigations please let me know, I will try to provide a minimal one tomorrow.
Regards
Ah, it looks like you are using Turborepo. You need to add the Environment variable in turbo.json to make it’s available for build: Using environment variables | Turborepo