Env Vars and index.ts Not Updating After Deploy
gliigand
HOBBYOP

a year ago

Hi Railway team,

We’re using a Node.js + TypeScript backend (ts-node src/index.ts as entry) and noticing that changes to our index.ts file and environment variables are not being reflected after pushing to GitHub.

We tried:

  • Edited index.ts with new console.log() statements — changes don’t show in logs
  • Added a new MONGO_URI_LIVE env var (previously MONGO_URI) — app still uses the old one
  • Triggered manual redeploys, no effect

It seems like Railway is caching the old version of the code or ignoring the new variables. Is there a known issue with TypeScript projects or variable propagation? How can we force Railway to actually use the updated code and env?

Thanks.

$10 Bounty

1 Replies

a year ago

it usually worked like this for me:

  1. I have VAR_1=value in Railway and use process.env.VAR_1 in Node app - everything works
  2. I change the VAR_1 to VAR_CHANGED_1 in Railway and redeploy with the change - the code is failing as it's using the old var name
  3. I then commit the change made to the code - the new deployment works fine

so I started doing this instead:

1. I have a working code referencing VAR_1

2. I ADD new var named VAR_CHANGED - so I have two of the variables at the same time - the old var is still working with the current code

  1. I commit the code change that starts using the new var
  2. delete the old var

Welcome!

Sign in to your Railway account to join the conversation.

Loading...