Error 503 a la hora de hacer peticion / 503 error doing a petition

Hola a todos, estoy tratando de desplegar una api hecha en spring boot con java y gradle, ya he desplegado una base de datos postgresql y cuando trabajo localmente, logro conectarme a esa base de datos, ahora bien, hago el despliegue de mi api y en commands run pongo el siguiente: java -jar build/libs/TopTrend-0.0.1.jar (TopTrend es el nombre de mi app) en los logs no tengo ningun error y mis variables de entorno tengo justamente las mismas que en mi api local, pero cuando hago una petición con el link que railway me da, obtengo un error 503 y no entiendo porque. Ayuda por favor 😦 Hi everyone, i'm trying to deploy an api using spring boot with java and gradle, i have already deploy a postgresql, working locally my spring boot api can connect to that database, now, when i deploy mu spring boot api in commands run i type this : java -jar build/libs/TopTrend-0.0.1.jar (TopTrend is my app name) and logs don't give me any error, i use the same ENV i use locally, i use in railway, but when i do a petition i get a 503 error and i don't understand why. I really need help 😦
30 Replies
Percy
Percy2y ago
Project ID: 5cf263e7-05ea-40b5-9d62-95471f49d9cf
Rodrigosblack
RodrigosblackOP2y ago
my project id: 5cf263e7-05ea-40b5-9d62-95471f49d9cf
Rodrigosblack
RodrigosblackOP2y ago
believe me, i have already try what the documentation says, i have tried with, PORT and HOST, also with server.port and server.addres (last 2 because spring request it like that) and didn't work :c
Brody
Brody2y ago
what port does the railway logs say your app is listening on normally you'd log that out as confirmation the server started
Rodrigosblack
RodrigosblackOP2y ago
logs tell me in port 8080 (but this is by default in spring) when i try with differents ports like 80, 463, also 6528, but answer is the same
Brody
Brody2y ago
your app should be listening on the environment variable PORT
Rodrigosblack
RodrigosblackOP2y ago
i have done that, and i get the same 503
Rodrigosblack
RodrigosblackOP2y ago
Rodrigosblack
RodrigosblackOP2y ago
unbelievable but i could fix it doing this
Rodrigosblack
RodrigosblackOP2y ago
thanks
Brody
Brody2y ago
in this screenshot your app tells me that it was not setup to listen on the environment variable PORT
Rodrigosblack
RodrigosblackOP2y ago
yeah, you're right, since the beginning we just run it by default this is my main
Rodrigosblack
RodrigosblackOP2y ago
Brody
Brody2y ago
that docs page really should have a code example for springboot, since you have still not set up your app to listen on the environment variable PORT
Rodrigosblack
RodrigosblackOP2y ago
yeah i know i have been fighting with this like 2 cryingman
Brody
Brody2y ago
lol im sure you could just google what i have told you to do
Rodrigosblack
RodrigosblackOP2y ago
At the end I could fix it, if u wouldn't open my mind about PORT i think i still would be suffering haha
Rodrigosblack
RodrigosblackOP2y ago
and i made this change
Brody
Brody2y ago
with that code, it works?
Rodrigosblack
RodrigosblackOP2y ago
Yeah it works
Brody
Brody2y ago
that's great!
Rodrigosblack
RodrigosblackOP2y ago
Why? Idk but it works haha
Brody
Brody2y ago
because railway assigns the PORT variable for you, and if you don't listen on it, railway won't know how to sent traffic to your app
Rodrigosblack
RodrigosblackOP2y ago
Oh, i see Thanks u saved cryingman
Brody
Brody2y ago
I will look into adding a code snippet to the docs page for springboot
Rodrigosblack
RodrigosblackOP2y ago
It would be great!
Brody
Brody2y ago
never touched a line of java in my life, so I'll see how that goes I'd probably just use your code minus the password thing
Rodrigosblack
RodrigosblackOP2y ago
Ok, if my code is useful i feel helpful haha
Brody
Brody2y ago
you definitely are!
Want results from more Discord servers?
Add your server