Unable to build or deploy a nodejs/ejs app.

Unable to build or deploy a nodejs/ejs app, although it runs ok with desktop localhost. I am new to web dev and Rail.
No description
43 Replies
Brody
Brody11mo ago
do you use yarn or npm locally?
thomas
thomas11mo ago
It is possible that this was related to our last incident. It has been fully resolved now. @BobPar_21
Brody
Brody11mo ago
i dont think so, their install command is npm ci but their build and start commands use yarn, they are also trying to do a yarn install in the build phase
thomas
thomas11mo ago
Sounds correct to me
Brody
Brody11mo ago
yeah theres some stuff to unpack and work through here
BobPar_21
BobPar_21OP11mo ago
NPM
Brody
Brody11mo ago
do you have a yarn lock file in your project?
BobPar_21
BobPar_21OP11mo ago
No yarn lock
Brody
Brody11mo ago
do you have any build or start commands set in the service settings?
BobPar_21
BobPar_21OP11mo ago
Only that supplied by Rail during build.
Brody
Brody11mo ago
railway does not set any build or start commands in the service settings, please go check
BobPar_21
BobPar_21OP11mo ago
in the railway.toml file
Brody
Brody11mo ago
do you have a railway.toml file?
BobPar_21
BobPar_21OP11mo ago
Only the yarn commands, they are greyed out.
Brody
Brody11mo ago
delete the railway.toml file please
BobPar_21
BobPar_21OP11mo ago
Yes , i do have the railway.toml file in the git repository. for some reason, it is duplicated in the repository.
Brody
Brody11mo ago
delete it please
BobPar_21
BobPar_21OP11mo ago
both?
Brody
Brody11mo ago
yes
BobPar_21
BobPar_21OP11mo ago
done
Brody
Brody11mo ago
did the new build fail?
BobPar_21
BobPar_21OP11mo ago
looks like the build is ok still does not deploy
BobPar_21
BobPar_21OP11mo ago
I have not added any shared variables and no action has been taken with the mongo service.
Brody
Brody11mo ago
then your app is likely crashing because it cant connect to mongo
BobPar_21
BobPar_21OP11mo ago
Sorry I had some problems with the log download. I can add shared variables, based on my best guess. at least you got it to build. I see it could not connect to the mongo service in the logs
Brody
Brody11mo ago
makes sense
BobPar_21
BobPar_21OP11mo ago
Ok, i was able to get it to connect to mongo, based on the deploy log. Still not deploying.
Brody
Brody11mo ago
deploy logs please
BobPar_21
BobPar_21OP11mo ago
Here is the log entries npm WARN config production Use --omit=dev instead.
[email protected] start
node index.js
Warning: connect.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process. Server on Port 3000... Connected to MongoDB... Still cant get that link to work sorry.
BobPar_21
BobPar_21OP11mo ago
okay, I made the recommended change for host and port in my index.js file. Still cannot get deployment. Here is the log: npm WARN config production Use --omit=dev instead.
[email protected] start
node index.js
Warning: connect.session() MemoryStore is not designed for a production environment, as it will leak memory, and will not scale past a single process. Connected to MongoDB... Any other ideas for troubleshooting?
Brody
Brody11mo ago
show me the code changes you have made please
BobPar_21
BobPar_21OP11mo ago
// Use PORT provided in environment or default to 3000 const port = process.env.PORT || 3000; // Listen on port and 0.0.0.0 app.listen(port, "0.0.0.0", function () { // ... });
Brody
Brody11mo ago
that's just copying from the docs page, is that what you are using in code now?
BobPar_21
BobPar_21OP11mo ago
yes
Brody
Brody11mo ago
what do you get when you visit the url
BobPar_21
BobPar_21OP11mo ago
I am simply inserting localhost:3000 in the address bar in Chrome and it gets rejected. Is this a browser issue?
Brody
Brody11mo ago
what does localhost have to do with railway? you are running your app on railway, you need to use the railway domain
BobPar_21
BobPar_21OP11mo ago
I am simply clicking on the link provided for the deployment which should work. Can you elaborate?
Brody
Brody11mo ago
does your service have a railway provided domain? if it doesn't, go to the service settings and generate one
BobPar_21
BobPar_21OP11mo ago
let me see.... IT WORKED!!!! THANKS. You have no idea how much time I have wasted working this problem on my on.
Brody
Brody11mo ago
no problem!
Want results from more Discord servers?
Add your server