Next.js Discord

Discord Forum

My automatic builds don't use my environment variables

Unanswered
Giant Chinchilla posted this in #help-forum
Open in Discord
Avatar
Giant ChinchillaOP
I always have to rebuild my automatic builds after a git push. Otherwise my project gets build with no environment variables.

31 Replies

Avatar
Giant ChinchillaOP
I don't see any errors min my build logs
Avatar
SharpieMaster
Are you using vercel?
Avatar
Giant ChinchillaOP
Yes sir
Avatar
SharpieMaster
You can select your project, then deployments and settings
There you can change and set your desired environment variables
As I think that the .env is not loaded when building in vercel
Interesting
Avatar
Giant ChinchillaOP
My builds always work the second time I build them. It's like when the cache is used, the env vars are not set
It's killing my CI/CD flow lol
Avatar
SharpieMaster
Image
Image
Image
Image
So when you go to this page you have all your variables that you want?
Avatar
Giant ChinchillaOP
Image
Yes, for all 3 of my apps.
All 3 have this issue also
Avatar
SharpieMaster
When you build, do you use build cache?
Avatar
Giant ChinchillaOP
locally or in Vercel?
Avatar
SharpieMaster
Vercel
Avatar
Giant ChinchillaOP
Yes
Avatar
SharpieMaster
there’s like a checkbox
Try re building without it checked
Avatar
Giant ChinchillaOP
that's what works
Avatar
SharpieMaster
?
Avatar
Giant ChinchillaOP
I mentioned I had to rebuild my projects for them to work
That's what I do. Rebuild them with build cache disabled
Avatar
SharpieMaster
Oh, are you having issues with the automatic build when pushing changes with git
Avatar
Giant ChinchillaOP
yes
those builds, always fail
Avatar
SharpieMaster
Idk about that, there might be a setting somewhere
Avatar
Giant ChinchillaOP
?
Avatar
SharpieMaster
On vercel
Avatar
Giant ChinchillaOP
Hmmm I'll keep poking around. Thank you!