23 days ago
Hi,
I have a Node service on Railway that deploys from a GitHub branch (auto-deploy on). I've hit a persistent problem and exhausted the usual fixes.
Problem: When I push a new commit, Railway builds it and marks the deployment “Deployment successful” / Active — but the running container keeps serving the OLD code from an earlier commit. It never switches to the new code.
How I can tell: My app's root endpoint returns a hardcoded version/build string that lives in the source. After pushing new commits (I've confirmed on GitHub that the source at the branch HEAD contains the new value), the live endpoint still returns the OLD value. The active deployment shows the new commit and “successful”, yet serves the old build.
Already tried (all still serve old code):
● Several fresh commits/pushes (Auto Deploy ON, Wait for CI OFF)
● Redeploy, multiple times
● Disconnect + reconnect the GitHub repo/branch
● Switching the builder from Railpack to Nixpacks and redeploying
Confirmed: the new code is on the branch HEAD on GitHub, and it boots fine locally (returns the new value). So it looks like a stuck build/image cache, or the deployment not swapping the running container.
What causes a “successful” deployment to keep serving an older image, and how do I force it to actually deploy the current HEAD? Thanks!
1 Replies
23 days ago
Your service has CDN caching enabled, which means the edge can serve a cached copy of your endpoint's response even after a new deployment goes live. If your root endpoint returns a response that the CDN treats as cacheable (e.g. a static content type, or HTML when HTML caching is set to Force), new deploys will keep serving the cached old response until the cache is purged. You can fix this by going to your service's Settings, scrolling to the Edge section, and either purging the cache manually ("Purge All"), or setting "Purge Cache on Deploy" to "Purge everything on each successful deploy" so future deploys automatically clear it. Alternatively, if this endpoint should never be cached, have your app return Cache-Control: no-store on that route.
Status changed to Awaiting User Response Railway • 23 days ago
16 days ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • 16 days ago