Crashing issue

rcharlescalderonTRIAL

a year ago

Hi, im trying to upload my backend server which uses MongoDB,Express and NodeJS but its crashing? Im not sure if its a .env issue or mongo issue as i've put in the variables needed
MongoServerError: bad auth : Authentication failed.

View Deploy details

ⓘ Deployment information is only viewable by Project members and Railway admins.

15 Replies


rcharlescalderonTRIAL

a year ago

Logs here ty!

Attachments


a year ago

Show me the mongoose client code please.


rcharlescalderonTRIAL

a year ago

This should be it unless I you wanted a downloadable link?

Attachments


a year ago

Have you set those two environment variables up at service variables?


rcharlescalderonTRIAL

a year ago

Yea, and out of desperation I tried every combination

Attachments


a year ago

You really did, have you whitelisted 0.0.0.0/0 in atlas?


rcharlescalderonTRIAL

a year ago

Yea I think so, this is my Network Access

Attachments


rcharlescalderonTRIAL

a year ago

Okay I think I did something, in my package.json I changed my script start to "start": "nodemon server.js", as I was running "dev": "nodemon server.js", if that mattered and now in the logs im getting a different error

Attachments


a year ago

Never use nodemon in a production environment such as Railway.

Are you committing your node_modules folder it GitHub?


rcharlescalderonTRIAL

a year ago

Yea the node_modules folder is in my GitHub should I put it in my gitignore, and how should my package.json look

Attachments


a year ago

No need to over think it -

nodemon server.js -> node server.js

And you should also never be committing your node_modules to GitHub, delete the folder from GitHub and add it to your .gitignore

It might be beneficial if you could share the repo, I may spot other incorrectly done stuff.


rcharlescalderonTRIAL

a year ago

Will do, I removed the node_modules and added node server.js in my package.json but now im getting the same error I did originally which I will attach
repo:https://github.com/rCharlesCalderon/Photo-tagging/tree/main/server

Attachments


rcharlescalderonTRIAL

a year ago

The code is a mess, still learning better practices but ty


a year ago

You have hardcoded your username and password in code, and have committed your .env file.


Crashing issue - Railway Help Station