Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoNetworkError: failed to connect to server [localhost:27017] on first connect [{ MongoError: Authentication failed. #655

Closed
Braedencraig opened this issue Dec 30, 2020 · 2 comments · Fixed by #710

Comments

@Braedencraig
Copy link

Cannot authenticate my db even though my credentials are correct. Have tried almost everything under the sun. Am running BIG SUR. Could this be the issue?

@datduyng
Copy link

I am running on a window and facing the same problem.

@KrizaLee
Copy link

Modify:

username: getFileEnv(adminUsername) || getFileEnv(dbAuthUsername) || mongo.username || dbAuthUsername,
password: getFileEnv(adminPassword) || getFileEnv(dbAuthPassword) || mongo.password || dbAuthPassword,

To:

    username: getFileEnv(adminUsername) || getFileEnv(dbAuthUsername) || mongo.username,
    password: getFileEnv(adminPassword) || getFileEnv(dbAuthPassword) || mongo.password,

When the MongoDB username and password are empty, the username will default to dbAuthUsername, and the password will default to dbAuthPassword

const dbAuthUsername = 'ME_CONFIG_MONGODB_AUTH_USERNAME';
const dbAuthPassword = 'ME_CONFIG_MONGODB_AUTH_PASSWORD';

So will cause an exception: MongoError: Authentication failed.

JafarAkhondali added a commit that referenced this issue May 30, 2021
+ Remove extra parameters documentation for connection config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants