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.
1 Replies
a year ago
it usually worked like this for me:
- I have
VAR_1=valuein Railway and useprocess.env.VAR_1in Node app - everything works - I change the
VAR_1toVAR_CHANGED_1in Railway and redeploy with the change - the code is failing as it's using the old var name - 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
- I commit the code change that starts using the new var
- delete the old var