R
Railway10mo ago
Teddy C

Service running on 0.0.0.0:$PORT but cannot connect to it

I'm running a gradio app on 0.0.0.0:7860 and have set PORT variable to 7860, but still cannot connect to the app
No description
No description
No description
Solution:
that's good, but you don't have server_port set to the environment variable PORT
Jump to solution
13 Replies
Percy
Percy10mo ago
Project ID: d6fa70bc-e4b0-4499-9acb-e45ca2cad6a4
Teddy C
Teddy COP10mo ago
d6fa70bc-e4b0-4499-9acb-e45ca2cad6a4
Brody
Brody10mo ago
what kind of app is this?
Teddy C
Teddy COP10mo ago
gradio app (https://gradio.app)
Gradio
Build & Share Delightful Machine Learning Apps
Brody
Brody10mo ago
what have you set for server_name ?
Teddy C
Teddy COP10mo ago
0.0.0.0 (it works locally and on other cloud platforms)
No description
Solution
Brody
Brody10mo ago
that's good, but you don't have server_port set to the environment variable PORT
Teddy C
Teddy COP10mo ago
the default port is 7860, and the deployment log (1st screenshot at the top) confirms that it's listening on 7860, so it's weird and I couldn't figure out why it just won't work on railway
Brody
Brody10mo ago
please see my above message, gradio is not listening on PORT
Teddy C
Teddy COP10mo ago
wow it worked now when I specify PORT in the code, thank you Brody! but I still don't understand why that's necessary, since it's listening on 7860 by default already
Brody
Brody10mo ago
seems it wasnt, you always want to be listening on the PORT environment variable when running apps on railway
Teddy C
Teddy COP10mo ago
but the log shows 7860?
Brody
Brody10mo ago
thats not the auto generated port railway expects your app to listen on
Want results from more Discord servers?
Add your server