a month ago
I've changed the generated domain for an api service, and after pushing new commits and redeploying, dashboard card shows the app is deployed at the old domain. Other services referencing the address are also build using the old value.
But the service itself is deployed at the new domain, the link from the settings is opening the correct working address.
How do I fix this?
5 Replies
a month ago
When you change a generated domain in Railway, the new domain updates in the service settings, but other parts of your project may still reference the old one. This happens because the old domain can remain cached in environment variables, the dashboard metadata, or even the build cache of dependent services.
To fix this, check the environment variables for all related services and update any that still contain the old domain.
Then save and redeploy after making changes.
f other services depend on this one, manually redeploy them as well and clear their build caches if necessary so they use the new value.
a month ago
How do I clear build caches? I've tried pushing new commits several times, manually redeploying via the menu option, and redeploying dependent services, all of this was not fixing the issue. Both old and new deployments were accessible at the old and new domains for several hours, although I have zero teardown time.
What fixed the issue was removing the deployments for the service and all dependent ones, and then deploying again.
This looks like a really unattended and underthought trough feature/bug. I would suggest, after changing domains, the change should be staged and trigger clearing caches and redeployment for all affected services.
Dear Railway, please fix this.
a month ago
Agree with this. Having some way to automatically trigger a rebuild/cache clear when a domain gets changed to refresh any services referencing the RAILWAY_PUBLIC_DOMAIN ENV variable would be very helpful. I've been testing a Drupal setup where the domain gets added to the trusted host patterns of the site through the ENV variable, this works until you change the domain and the site becomes inaccessible until you create a new deployment, since the ENV variable is now stale.
a month ago
I think what you're looking for is deployment dependencies.
Railway supports this via Reference Variables, which ensure that services are deployed in the correct order when applying a staged change or duplicating an environment. However, I think this only applies on initial startup and may not automatically trigger on redeployments or restarts.
More details here: Deployment Dependencies – Startup Ordering
a month ago
Yeah, so it does work for initial deploy. However, once it's deployed and you change the domain name, then that deployment needs to be removed and deployed again.

