R
Railwayβ€’12mo ago
hidden whale

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
No description
19 Replies
Percy
Percyβ€’12mo ago
Project ID: 1d273f0b-fde3-4c52-8939-0603176da3c2
hidden whale
hidden whaleOPβ€’12mo ago
1d273f0b-fde3-4c52-8939-0603176da3c2
MantisInABox
MantisInABoxβ€’12mo ago
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.
hidden whale
hidden whaleOPβ€’12mo ago
No such button for me to generate the domain
No description
MantisInABox
MantisInABoxβ€’12mo ago
That is the individual project settings. You want to click on the "core" service and the settings tab like in the screenshot below
No description
hidden whale
hidden whaleOPβ€’12mo ago
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
MantisInABox
MantisInABoxβ€’12mo ago
Can you show me the deploy logs for your Core service?
hidden whale
hidden whaleOPβ€’12mo ago
No description
MantisInABox
MantisInABoxβ€’12mo ago
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 solid
hidden whale
hidden whaleOPβ€’12mo ago
right 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
MantisInABox
MantisInABoxβ€’12mo ago
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.
hidden whale
hidden whaleOPβ€’12mo ago
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
MantisInABox
MantisInABoxβ€’12mo ago
Can you share your environment variable screen. You don't have to expose the values of the variables
hidden whale
hidden whaleOPβ€’12mo ago
I have shared the env var list along with how my main.ts looks like nestjs application
No description
No description
MantisInABox
MantisInABoxβ€’12mo ago
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?
hidden whale
hidden whaleOPβ€’12mo ago
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
MantisInABox
MantisInABoxβ€’12mo ago
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 app
hidden whale
hidden whaleOPβ€’12mo ago
so this doesnt work
abc-app:3000/entity
abc-app:3000/entity
this does
abc-app/entity
abc-app/entity
although PORT variable is injected in env variables understood πŸ‘ thank you thank you my good sir
Brody
Brodyβ€’12mo ago
for clarity you can only access http apps over https and port 443 railway will map the randomly generated PORT to 443
Want results from more Discord servers?
Add your server