9 days ago
Custom environment variables added in the Variables tab are not being
injected into the running container, even after redeploying. Railway's
own built-in variables (RAILWAY_ENVIRONMENT, RAILWAY_PROJECT_ID, etc.)
ARE present, and NODE_ENV is present, but no custom variable I add —
including a brand new test variable named TEST_VAR with no special
characters — ever appears in process.env at runtime.
I've confirmed this happens on:
- The original service in project "fulfilling-imagination"
- A newly-created service in the same project
- After upgrading from Free to Hobby plan
I verified this via a direct HTTP diagnostic endpoint that prints all
process.env keys, not just via the logs viewer, so this isn't a
logging display issue.
Service ID: 442f6173-8ee9-45bf-82e6-a5f9e660c577 (original)
Project ID: 38351d94-6664-4723-a819-d59e79d100ea
2 Replies
9 days ago
This thread has been opened as a bounty so the community can help solve it.
Status changed to Open Railway • 9 days ago
9 days ago
make sure you have applied the changes after saving the env because when you change your env variable, the changes are saved to draft until you deploy the changes, if it didnt work, try open the command palette (Ctrl+K) and select "Redeploy Latest Commit"
what kind of app you're running btw?
9 days ago
This does sound like a platform/environment scoping issue if Railway-provided variables are present but every custom variable is missing at runtime.
A few things I would double-check:
-
Make sure the variable is added to the exact same service + environment that is deployed.
The most common cause is adding variables under one environment/service while the running deployment belongs to another.
-
From the CLI, verify Railway sees the variable on that service/environment:
railway variable list --service 442f6173-8ee9-45bf-82e6-a5f9e660c577 --environment production --kv
-
In the runtime diagnostic endpoint, also print these built-ins:
- RAILWAY_PROJECT_ID
- RAILWAY_SERVICE_ID
- RAILWAY_ENVIRONMENT_ID
- RAILWAY_DEPLOYMENT_ID
Then compare them against the project/service/environment where the variable was added.
-
If this is Docker-based, make sure you are checking runtime env, not build-time env. But since you said an HTTP endpoint prints
process.env, this should already be runtime. -
Try setting a variable through CLI instead of the dashboard:
railway variable set TEST_VAR=hello --service 442f6173-8ee9-45bf-82e6-a5f9e660c577 --environment production
Then redeploy.
If railway variable list shows TEST_VAR, and the running container shows the matching RAILWAY_SERVICE_ID / RAILWAY_ENVIRONMENT_ID, but TEST_VAR is still missing from process.env, then this is very likely a Railway-side injection bug for that project/environment.
The useful evidence for Railway support would be:
- Project ID
- Service ID
- Environment ID
- Deployment ID
- Output of
railway variable list - Runtime endpoint output showing built-in Railway variables present but custom variables absent