Problems with environment variables

4 months ago

Whenever I define an environment variable and confirm the change, the variable in the project says it is not defined, but in Vercel it works correctly…

$20 Bounty

16 Replies

4 months ago

are you hitting the redeploy button after you set the env variable?


4 months ago

Just click to accept the variable change in the purple notification at the top of the site, and it is automatically implemented. Not enough?


4 months ago

yeah that's what i meant - is it still not being applied after you hit the purple notif?


4 months ago

Yes, my application has an error that the variable is not applied in the environment.


4 months ago

when you go to your service -> variables, do you see it there?


4 months ago

I had to remove the variable checks, because before I changed it, it was like this: It checked if it existed and was filled in, and if not, it triggered an error. And it always triggered the error.


4 months ago

Yes


4 months ago

Now I was able to deploy, but I had to remove the checks to see if the variable exists.


4 months ago

are you building it via railpack? im not sure what can cause that condition to fail tbh


4 months ago

Dockerfile


4 months ago

is your dockerfile trying to read them during the docker build or during run time?


4 months ago

build time becouse run nextjs build


4 months ago

I think that may be the cause, I can do some testing once im back at my pc (railpack might deal with it better since its build time)


4 months ago

But why do I have to use Railpack? Will I need to use it for all apps that I upload to your infrastructure? I want to use dockerfile, which is already configured by default in my projects.


4 months ago

im just a person helping, not an employee.
https://docs.docker.com/build/building/variables/

youre trying to build args during build time using env variables which i do not believe would work. youd have to define them as args during build time.

railpack is developed by railway, https://docs.railway.com/reference/variables and so it allows env vars during build time


4 months ago

for your specific use case, you might want to look at https://docs.railway.com/guides/dockerfiles#using-variables-at-build-time


Loading...