Magic ports aren't being resolved correctly
I have just generated a domain that points to port 4000 of my railway deployment.
Problem is, it's stll pointing to the port of my custom domain (9600)
Any idea why?
Project: https://railway.app/project/045e21af-ff58-4d2c-a95a-4147dea211c9/service/c040e311-95df-41bf-82ff-e87da0aa84fe/settings
Railway
Railway
Railway is an infrastructure platform where you can provision infrastructure, develop with that infrastructure locally, and then deploy to the cloud.
31 Replies
Project ID:
045e21af-ff58-4d2c-a95a-4147dea211c9,c040e311-95df-41bf-82ff-e87da0aa84fe
can you show me the public networking section of your service please
Here you go!
what port did you choose when you setup the custom domain?
4000
Tried creating another domain with another running port (4001). It's still showing a blank screen https://curator-production-658d.up.railway.app/
where does this 9600 port come in play?
That's the default port (currently set by the $PORT variable)
I'm running two services in the same instance here. The start command runs the 9600 port and the other application runs after the first has initialized
your custom domain works?
Yup!
curator.senja.io
https://curator.senja.io
Oddly enough, if I create a new domain and point it to 9600, it works just fine
but the railway provided domain does not?
The railway provided domain (sj-curator-production.up.railway.app) works just fine. If I create a new domain pointing to 9600 it also works https://curator-production-1d4f.up.railway.app/
im lost, then what is the issue?
Ah sorry. let me try to explain better
I'm trying to use magic ports in railway
The new feature that I'm really excited about π₯
I'm running two apps on a single instance
One on port 9600 (default). That is connected to my custom domain and the railway provided domain which works just fine
And the other on port 4000.
I'm now trying to provision a new domain for port 4000
But when I do, it only shows a blank screen like so https://curator-production-2781.up.railway.app/
And I'm not sure why this is happening
For the domain on port 9600, it works just fine
And when I provision a new domain for port 9600, it works fine too. https://curator-production-1d4f.up.railway.app/
It's just port 4000 which shows a blank screen
Let me know if that's still unclear
how do you know the blank screen is not your app?
The markup doesn't match is one
It's just an empty <head> and <body> tag
But in my app, the default markup is much different.
I've noticed this also happens when I choose a port that isn't running.
the white screen is a 0 byte response
how do you know your app is running on the port 4000?
the logs indicate it is.
It also shows up in Railway magic
you are running a dev server, you can't really expect things to work properly when you run a dev server
from this, i assume you are trying to run a frontend and a backend in the same service?
So the use-case is a little weird.
I'm trying to run an automated integration test suite and preview the results in vitest (so I can post it to slack).
Which is why I'm using a dev server
okay well thats better than just running a dev server to handle the sites traffic
where are these tests being ran from? within the container?
exactly
And i'm just running an exec command in node to start them up
so why does it need to be exposed publicly if the tests are being ran inside the container?
The goal was being able to debug quickly. We're running a few snapshot tests (the json structure we're testing can often change), so being able to see the snapshots in vitest's ui is very helpful
The goal was to have a one click link to the vitest report
gotcha
Ideally it would just be a static html page, and I could serve that from the main server, but there's no way to do this in vitest afaik
hey as long as you arent serving the actual site with a dev server thats good with me
very common mistake
I can imagine ahaha
Solution
try having the dev server listen on the 0.0.0.0 host
trying it now!
IT WORKED!!!!
THANK YOU SO MUCH π
no problem!