Unable to find the deployment URL on railway project
I have a nestjs project using postgres. I succesfully deployed the application and the database is also linked, but I am unable to find the nestjs deployement link setup by railway app. Need some help
19 Replies
Project ID:
1d273f0b-fde3-4c52-8939-0603176da3c2
1d273f0b-fde3-4c52-8939-0603176da3c2
On the
core
service, you can select "settings" and there will be a button to "generate domain"
Click that button and give it a few minutes to fully propagate DNS and you will be able to use that domain that is generated for you.No such button for me to generate the domain
That is the individual project settings. You want to click on the "core" service and the settings tab like in the screenshot below
thank you, finally found it! I am very grateful.
But the deployment link generated isn't accesible, I have tried using curl over the endpoint. It's unreachable. Is there anything else I need to do
Can you show me the deploy logs for your Core service?
Perfect. So, your application is not listening on the
PORT
environment variable, it is listening specifically on port 3000. You will need to add an environment variable of PORT
to your service under the VARIABLES
tab. Call it PORT
and set the value to 3000
, let the redeploy happen, and everything should be solidright now the port is hardcoded in the system
so the port is still still working, no? π€
the PORT in my env variable is the port for database within the system
Railway automatically assigns a random port. Since you are specifically listening on port 3000, you need to set an environment variable on the service... You should not be using PORT as your environment variable for the database. PORT is what your application listens on.
understood π let me try it out
Tried it, the URL is still not being accesible.
The logs remain the same, since the PORT is 3000 but now coming from env variables
Can you share your environment variable screen. You don't have to expose the values of the variables
I have shared the env var list along with how my main.ts looks like nestjs application
Okay, since you are using
process.env.PORT || 3000
you can remove the PORT
environment variable, and it will use the randomly assigned port provided by Railway. Are there any errors showing in the deploy logs when you try to access the application?no error logs as well
this is interesting, i have been trying to access it with a port
but I can access the app without a port
Railway will automatically inject a random port number as
PORT
if you do not specify the port environment variable
You don't need to use the port number when trying to access your app. Railway has a reverse proxy that directs the traffic to your appso this doesnt work
this does
although PORT variable is injected in env variables
understood π thank you
thank you my good sir
for clarity you can only access http apps over https and port 443
railway will map the randomly generated PORT to 443