R
Railwayβ€’15mo ago
jaemil

Problem with hosting authentication service

Hello, i have a problem with hosting my nodejs express application (getting a 503). Frontend and backend is successfully running as excepted. Link to auth server: https://auth.findnlink.com/ Service id: ffd2f9a6-afc0-4546-aa43-bc9b1935038a const PORT = process.env.PORT || 3000; const HOST = "0.0.0.0"; server.listen(PORT, HOST, () => { console.log(Findnlink Auth Server running on ${HOST}:${PORT}); app.emit("ready"); }); Thanks in advance
20 Replies
Percy
Percyβ€’15mo ago
Project ID: ffd2f9a6-afc0-4546-aa43-bc9b1935038a
jaemil
jaemilβ€’15mo ago
Log is printing: Findnlink Auth Server running on 0.0.0.0:3000
Brody
Brodyβ€’15mo ago
show me a screenshot of your service variables?
jaemil
jaemilβ€’15mo ago
sure 1 sec
jaemil
jaemilβ€’15mo ago
Brody
Brodyβ€’15mo ago
try removing the port, you don't need to specify your own, railway will auto generate a port for you
jaemil
jaemilβ€’15mo ago
hm ok, because i had the same problem with the backend service and then i added my PORT and it worked. Ok removed it
Brody
Brodyβ€’15mo ago
yeah but it's best to just listen on the PORT railway wants you to then to specify your own also just as a sanity check, this Auth service does communicate over http right?
jaemil
jaemilβ€’15mo ago
no im using https and still not working without port
Brody
Brodyβ€’15mo ago
same transport protocol what does the logs say now?
jaemil
jaemilβ€’15mo ago
yarn run v1.22.19 $ node server.js [HPM] Proxy created: / -> https://backend.findnlink.com [HPM] Proxy rewrite rule created: "^/proxy" ~> "" MongoDB - Database connection established successfully. Findnlink Auth Server running on 0.0.0.0:8078
Brody
Brodyβ€’15mo ago
that looks good what type of Auth server is this? home grown?
jaemil
jaemilβ€’15mo ago
yes i think so. Home grown means like that i've coded it myself? and not using any prebuilt auth
Brody
Brodyβ€’15mo ago
and you are absolutely sure you are staring an http server and not a tcp server?
jaemil
jaemilβ€’15mo ago
i think i found the problem: const server = https.createServer({ key: fs.readFileSync("./certs/key.pem"), cert: fs.readFileSync("./certs/cert.pem") }, app); this shouldn't work calling readFile..) will remove it
Brody
Brodyβ€’15mo ago
yeah start http server, not https, railways handles https for you
jaemil
jaemilβ€’15mo ago
ok will try my luck, ty πŸ™‚ Will come back if something isn't working properly
Brody
Brodyβ€’15mo ago
sounds good
jaemil
jaemilβ€’15mo ago
yey its working ty
Brody
Brodyβ€’15mo ago
awesome!!