R
Railway10mo ago
Gero

Unable to access my project. ERROR 503

hi so I published this Next.js project which uses an Express server but I am having issues when trying to open the URL. I get 503 although the build is completed successfully, does anyone know why this might happen?
No description
No description
No description
No description
36 Replies
Fragly
Fragly10mo ago
where are you defining your PORT variable?
Gero
GeroOP10mo ago
I need a PORT variable?
Brody
Brody10mo ago
your code needs to listen on the PORT environment variable, you don't need to set one yourself though, it's automatically assigned
Gero
GeroOP10mo ago
Do I need a PORT in here?
No description
Brody
Brody10mo ago
please see the last message I sent
Gero
GeroOP10mo ago
like this am I listening correctly?
No description
Brody
Brody10mo ago
I believe fragly has asked you to show him where that variable is defined in your code
Gero
GeroOP10mo ago
It's defined here in my server. Is that correct?
No description
Brody
Brody10mo ago
yeah that variable looks like what it should be set to, you're good there. what do your deployment logs say?
Gero
GeroOP10mo ago
deployment logs look good don't they?
No description
No description
No description
Brody
Brody10mo ago
lots of information is being cut off in these screenshots, instead please use this https://bookmarklets.up.railway.app/log-downloader/
Gero
GeroOP10mo ago
this is my error
No description
Brody
Brody10mo ago
yep I saw the screenshots in your first post message
Gero
GeroOP10mo ago
Brody
Brody10mo ago
you're exiting in the app.listen callback
Gero
GeroOP10mo ago
yes is this not good?
Brody
Brody10mo ago
if your app exits, how is it supposed to handle requests, when it's not running!?
Gero
GeroOP10mo ago
it doesn't continue to run when it exits. so I get rid of process.exit();
Brody
Brody10mo ago
read that sentence out loud please ..yes
Gero
GeroOP10mo ago
thanks man I will try building again now it actually fails to built. It timed out.
Brody
Brody10mo ago
this looks like a separate issue, this time an issue with railway
Gero
GeroOP10mo ago
should I try again later or is there some fix to this?
Brody
Brody10mo ago
try again in 10 minutes
Gero
GeroOP10mo ago
nope I think it gets stuck after building nextBuild and it we need to exit.
Brody
Brody10mo ago
isnt next the frontend?
Gero
GeroOP10mo ago
next is ssr so I guess not. But anyway it now builds again since I added back in process.exit();
Brody
Brody10mo ago
something being SSR doesn't mean it's not a frontend. you should be running next and payload in separate railway services
Gero
GeroOP10mo ago
Ok so my server as it is does not work as a backend/front end like this all in one? I should do an express server for payload only as one service and another one for next is that correct?
Brody
Brody10mo ago
correct
Gero
GeroOP10mo ago
this is not MERN stack project so I kind of hoped to have all in one next project. It should be possible. is this 503 error related to not splitting the front end from the backend?
Brody
Brody10mo ago
yes, you are exiting, you will need to split the backend and frontend apart
Gero
GeroOP10mo ago
Now I got 404 error cannot get though. Any idea why?
No description
Brody
Brody10mo ago
have you split your backend and frontend into two separate railway services?
Gero
GeroOP10mo ago
no not yet but the payload cms is working
Brody
Brody10mo ago
please split them apart
Want results from more Discord servers?
Add your server