R
Railwayβ€’4mo ago
WilsonSquared

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.
Solution:
try having the dev server listen on the 0.0.0.0 host
Jump to solution
31 Replies
Percy
Percyβ€’4mo ago
Project ID: 045e21af-ff58-4d2c-a95a-4147dea211c9,c040e311-95df-41bf-82ff-e87da0aa84fe
Brody
Brodyβ€’4mo ago
can you show me the public networking section of your service please
WilsonSquared
WilsonSquaredβ€’4mo ago
Here you go!
No description
Brody
Brodyβ€’4mo ago
what port did you choose when you setup the custom domain?
WilsonSquared
WilsonSquaredβ€’4mo ago
4000 Tried creating another domain with another running port (4001). It's still showing a blank screen https://curator-production-658d.up.railway.app/
Brody
Brodyβ€’4mo ago
where does this 9600 port come in play?
WilsonSquared
WilsonSquaredβ€’4mo ago
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
Brody
Brodyβ€’4mo ago
your custom domain works?
WilsonSquared
WilsonSquaredβ€’4mo ago
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
Brody
Brodyβ€’4mo ago
but the railway provided domain does not?
WilsonSquared
WilsonSquaredβ€’4mo ago
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/
Brody
Brodyβ€’4mo ago
im lost, then what is the issue?
WilsonSquared
WilsonSquaredβ€’4mo ago
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
Brody
Brodyβ€’4mo ago
how do you know the blank screen is not your app?
WilsonSquared
WilsonSquaredβ€’4mo ago
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.
Brody
Brodyβ€’4mo ago
the white screen is a 0 byte response how do you know your app is running on the port 4000?
WilsonSquared
WilsonSquaredβ€’4mo ago
the logs indicate it is.
No description
WilsonSquared
WilsonSquaredβ€’4mo ago
It also shows up in Railway magic
No description
Brody
Brodyβ€’4mo ago
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?
WilsonSquared
WilsonSquaredβ€’4mo ago
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
Brody
Brodyβ€’4mo ago
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?
WilsonSquared
WilsonSquaredβ€’4mo ago
exactly And i'm just running an exec command in node to start them up
Brody
Brodyβ€’4mo ago
so why does it need to be exposed publicly if the tests are being ran inside the container?
WilsonSquared
WilsonSquaredβ€’4mo ago
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
Brody
Brodyβ€’4mo ago
gotcha
WilsonSquared
WilsonSquaredβ€’4mo ago
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
Brody
Brodyβ€’4mo ago
hey as long as you arent serving the actual site with a dev server thats good with me very common mistake
WilsonSquared
WilsonSquaredβ€’4mo ago
I can imagine ahaha
Solution
Brody
Brodyβ€’4mo ago
try having the dev server listen on the 0.0.0.0 host
WilsonSquared
WilsonSquaredβ€’4mo ago
trying it now! IT WORKED!!!! THANK YOU SO MUCH πŸ’œ
Brody
Brodyβ€’4mo ago
no problem!
Want results from more Discord servers?
Add your server