Search code examples
javascriptnode.jsmongodbportnodemon

When I run nodemon server I get the error "bad auth Authentication failed. [nodemon] app crashed - waiting for file changes before starting..."


I have been working on a node.js / react app and I uploaded it to heroku. About a month ago it worked (locally and on heroku). Now it doesn't. I seem to get the same error when I run nodemon server even when I download old commits of the app (which did work). Terminal does this:

TDI-MacBook-Air:udemy-MERN-FromGithub bob$ nodemon server
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Server started on Port 5000
bad auth Authentication failed.
[nodemon] app crashed - waiting for file changes before starting...

1. downloaded old an old commit from my githum https://github.com/PaulAyling/COURSE-MernStackFrontToBack

2. ran at the terminal: npm install

3. Ran at terminal nodemon server (got the same error as before).

4. I tried connecting to the mongo database with postman and got the following error:

Could not get any response
There was an error connecting to http://localhost:5000/api/posts.
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General

After reading the error I changed the SSL Certificate verification to off but it did not fix the problem

Theres quite alot of code - not sure what the most usefull files would be - but it did work a month ago.

The full code is here: https://github.com/PaulAyling/COURSE-MernStackFrontToBack

If you want specific code let me know and I'll post it.

Expecting the server to run. Error is;

TDI-MacBook-Air:udemy-MERN-FromGithub bob$ nodemon server
[nodemon] 1.19.0
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node server.js`
Server started on Port 5000
bad auth Authentication failed.
[nodemon] app crashed - waiting for file changes before starting...

Solution

  • In your /config/default.json or /config/production.json there is an object mongoURI.

    Replace the url with with user password and username not your account name and account password that currently functions.

    You have probably deleted that user or changed the password.

    Also I tried launching in my local machine and it worked without any trouble.

    enter image description here