Custom variables not loaded

ltrubov
FREEOP

a month ago

This is a recent change, but I'm not sure exactly how recent, since I only noticed it once a monthly CI run failed.

I've got a service that uses a number of environment variables, and previously, whenever I loaded an environment, either via railway shell, or in CI with a valid RAILWAY_TOKEN set, I got those variables along with provided ones like RAILWAY_SERVICE_ID and DATABASE_URL.

Now, I only get those provided variables, and none of the ones I added myself. Here's the entire output of railway variables -k (sensitive data hidden):

DATABASE_PUBLIC_URL=****
DATABASE_URL=***
PGDATA=/var/lib/postgresql/data/pgdata
PGDATABASE=railway
PGHOST=postgres.railway.internal
PGPASSWORD=***
PGPORT=5432
PGUSER=postgres
POSTGRES_DB=railway
POSTGRES_PASSWORD=****
POSTGRES_USER=postgres
RAILWAY_ENVIRONMENT=production
RAILWAY_ENVIRONMENT_ID=***
RAILWAY_ENVIRONMENT_NAME=production
RAILWAY_PRIVATE_DOMAIN=postgres.railway.internal
RAILWAY_PROJECT_ID=***
RAILWAY_PROJECT_NAME=***
RAILWAY_SERVICE_ID=***
RAILWAY_SERVICE_NAME=Postgres
RAILWAY_SERVICE_RAILS_URL=rails-production-****.up.railway.app
RAILWAY_TCP_APPLICATION_PORT=5432
RAILWAY_TCP_PROXY_DOMAIN=viaduct.proxy.rlwy.net
RAILWAY_TCP_PROXY_PORT=43364
RAILWAY_VOLUME_ID=***
RAILWAY_VOLUME_MOUNT_PATH=/var/lib/postgresql/data
RAILWAY_VOLUME_NAME=fly-volume
SSL_CERT_DAYS=820

Since there's no issue with the actual service, the variables must be present there. But how do I get them into local shell or CI?

$10 Bounty

4 Replies

Railway
BOT

a month ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


ltrubov
FREEOP

a month ago

Update: investigation showed variables are there for the CI, but not for the local shell. CI failed because one of the variables was a token for an external service that expired. But it'd still be nice to have the local shell duplicate the environment exactly. How can this be done?


fra
HOBBYTop 10% Contributor

a month ago

I"m not sure if I understood correctly, but is this what you need?
https://docs.railway.com/guides/manage-variables#fetch-variables-for-a-service


fra

I"m not sure if I understood correctly, but is this what you need?https://docs.railway.com/guides/manage-variables#fetch-variables-for-a-service

ltrubov
FREEOP

a month ago

No -- this is about accessing them in the railway shell , not via an API.


Custom variables not loaded - Railway Help Station