a month ago
Project: gracious-serenity (c19fa85f-43c6-4f33-8cdd-d3e5abadcf13)
Service: weekly-tax-app
Issue: Environment variables configured in service config (DATABASE_URL, JWT_SECRET, etc.) are not reaching process.env at runtime. This happens with both:
Hardcoded string values
Reference variables like ${{ Postgres.DATABASE_URL }}
Evidence: Deployment logs show DATABASE_URL: undefined even though PORT env var DOES work
Latest deployment: bb1c1802-a41b-4cc0-8fb8-7f1bcf98b99c
Log output: "=== ENV VARS AT STARTUP === ... DATABASE_URL: undefined ... All env keys: []"
8 Replies
a month ago
Having looked into this, the issue appears to be in your application code or configuration rather than the Railway platform itself, which puts it outside what Railway support can resolve directly.
This is exactly the kind of problem the Railway community is good at, so we'd like to open your thread as a community bounty. Railway pays a bounty to the community member who solves it, and threads like this usually get picked up quickly.
Opening it makes this entire thread public, including everything already posted. Nothing becomes public until you decide. Use the buttons below.
- Open to the community - Before you click, take a moment to edit or remove anything you'd rather not share. The thread becomes publicly visible right away.
- Keep it private and close the thread - Nothing becomes public and the thread closes.
Status changed to Awaiting User Response Railway • about 1 month ago
a month ago
This thread has been opened as a public bounty so the community can help solve it. The thread and any further activity are now visible to everyone.
Status changed to Open Railway • about 1 month ago
a month ago
Environment variables not injecting into Node.js container despite being configured
a month ago
Service: weekly-tax-app (Node.js/Express, Pavak01/weekly-tax-app)
Project: gracious-serenity
Environment: production
ISSUE: Environment variables configured in Railway service config are not reaching process.env at runtime.
EVIDENCE:
-
Service config shows 16 variables set (DATABASE_URL, JWT_SECRET, AWS_*, etc.)
-
Deployment succeeds
-
Container starts and logs "Backend running on port 8080"
-
Diagnostic logs show:
PORT: 8080 ✅
DATABASE_URL: undefined ❌
All env keys: [] ❌ (ZERO custom env vars reach container)
TRIED:
- Hardcoded strings
- Reference variables (${{ Postgres.DATABASE_URL }})
- Multiple redeploys
- Fresh builds
- Removed/re-added all variables
Latest deployment: dcbc0598-cdcf-47bc-b05f-43e1c879b919
Repo: https://github.com/Pavak01/weekly-tax-app (public)
PORT works, so env injection works. But custom variables don't. Why would DATABASE_URL be undefined when it's explicitly set in service config?
a month ago
Project: gracious-serenity (c19fa85f-43c6-4f33-8cdd-d3e5abadcf13)
Service: weekly-tax-app
Environment: production
Deployment: a02fcc73-aecd-41f4-abf2-ad65482390e5
ISSUE: Environment variables configured in the service are NOT being injected into the container, even though they exist in the service config.
EVIDENCE:
Diagnostic logging shows process.env at startup contains:
- Total env var count: 41
- Railway-provided vars: ✅ ALL PRESENT (RAILWAY_*, PORT, NODE_ENV, PATH, HOME, etc.)
- Service-configured vars: ❌ COMPLETELY MISSING (DATABASE_URL, JWT_SECRET, AWS_S3_BUCKET_NAME, AWS_ENDPOINT_URL, AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, TWO_FACTOR_ENCRYPTION_KEY, PASSWORD_RESET_TTL_MINUTES, RECEIPTS_S3_FORCE_PATH_STYLE, TWO_FACTOR_CHALLENGE_TTL_MINUTES, ADMIN_EMAILS, ALLOWED_ORIGINS, RULE_PUBLISH_SECRET)
Service config shows all 15+ variables are SET via API getServiceConfigTool (returned as ), but they don't reach process.env.
WHAT WAS TRIED:
✅ Hardcoded string values
✅ Reference variables (${{ Postgres.DATABASE_URL }})
✅ Multiple redeploys
✅ Removed dotenv/config (not the issue)
✅ Added 41 env vars are confirmed in container, but 0 of them are the configured service variables
Actual env var list present: CI, HOME, HOSTNAME, MISE_CACHE_DIR, MISE_CONFIG_DIR, MISE_DATA_DIR, MISE_INSTALLS_DIR, MISE_SHIMS_DIR, NODE_ENV, NPM_CONFIG_FETCH_RETRIES, NPM_CONFIG_FUND, NPM_CONFIG_PRODUCTION, NPM_CONFIG_UPDATE_NOTIFIER, PATH, PORT, PWD, RAILPACK_BUILT_AT, RAILPACK_VERSION, RAILWAY_BETA_ENABLE_RUNTIME_V2, RAILWAY_DEPLOYMENT_ID, RAILWAY_ENVIRONMENT, RAILWAY_ENVIRONMENT_ID, RAILWAY_ENVIRONMENT_NAME, RAILWAY_GIT_AUTHOR, RAILWAY_GIT_BRANCH, RAILWAY_GIT_COMMIT_MESSAGE, RAILWAY_GIT_COMMIT_SHA, RAILWAY_GIT_REPO_NAME, RAILWAY_GIT_REPO_OWNER, RAILWAY_PRIVATE_DOMAIN, RAILWAY_PROJECT_ID, RAILWAY_PROJECT_NAME, RAILWAY_REPLICA_ID, RAILWAY_REPLICA_REGION, RAILWAY_SERVICE_ID, RAILWAY_SERVICE_NAME, RAILWAY_SNAPSHOT_ID, SHLVL, _, __MISE_DIFF, __MISE_SHIM
NONE of the configured DATABASE_URL, JWT_SECRET, or AWS_ variables are present.*
This is a critical blocker. The service's own configured environment variables are not being passed to the running container, while Railway-provided variables work fine.
a month ago
Just to confirm; have you applied changes after adding the env variables?
Attachments
darseen
Just to confirm; have you applied changes after adding the env variables? 
a month ago
yes
a month ago
????
Status changed to Open medim • about 1 month ago
Status changed to Solved pavak01 • about 1 month ago