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?
36 Replies
where are you defining your
PORT
variable?I need a PORT variable?
your code needs to listen on the PORT environment variable, you don't need to set one yourself though, it's automatically assigned
Do I need a PORT in here?
please see the last message I sent
like this am I listening correctly?
I believe fragly has asked you to show him where that variable is defined in your code
It's defined here in my server. Is that correct?
yeah that variable looks like what it should be set to, you're good there.
what do your deployment logs say?
deployment logs look good don't they?
lots of information is being cut off in these screenshots, instead please use this https://bookmarklets.up.railway.app/log-downloader/
this is my error
yep I saw the screenshots in your first post message
you're exiting in the app.listen callback
yes is this not good?
if your app exits, how is it supposed to handle requests, when it's not running!?
it doesn't continue to run when it exits.
so I get rid of process.exit();
read that sentence out loud please
..yes
thanks man I will try building again
now it actually fails to built. It timed out.
this looks like a separate issue, this time an issue with railway
should I try again later or is there some fix to this?
try again in 10 minutes
nope I think it gets stuck after building nextBuild and it we need to exit.
isnt next the frontend?
next is ssr so I guess not. But anyway it now builds again since I added back in process.exit();
something being SSR doesn't mean it's not a frontend. you should be running next and payload in separate railway services
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?
correct
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?
yes, you are exiting, you will need to split the backend and frontend apart
Now I got 404 error cannot get though. Any idea why?
have you split your backend and frontend into two separate railway services?
no not yet but the payload cms is working
please split them apart