2 years 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.
ⓘ Deployment information is only viewable by Project members and Railway admins.
15 Replies
2 years ago
This should be it unless I you wanted a downloadable link?
Attachments
2 years ago
Yea, and out of desperation I tried every combination
Attachments
2 years 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
2 years ago
Never use nodemon in a production environment such as Railway.
Are you committing your node_modules folder it GitHub?
2 years 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
2 years 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.
2 years 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
2 years ago
The code is a mess, still learning better practices but ty
2 years ago
You have hardcoded your username and password in code, and have committed your .env file.