Rijdzuan Sampoerna
Rijdzuan Sampoerna

Reputation: 390

Azure Deployment MongoError: Authentication failed

How do we set authentication for mlab database to connect azure? I use Nodejs for the stack. Below the list of what I have done:

  1. Set up App Setting for mlab database as MONGODB_URI, and use mongodb://user:[email protected]:66666/database-name
  2. Create admin user on mlab database

This is the error appears,

MongoError: Authentication failed.
    at Function.MongoError.create (D:\home\site\wwwroot\node_modules\mongodb-core\lib\error.js:31:11)
    at D:\home\site\wwwroot\node_modules\mongodb-core\lib\connection\pool.js:497:72
    at authenticateStragglers (D:\home\site\wwwroot\node_modules\mongodb-core\lib\connection\pool.js:443:16)
    at Connection.messageHandler (D:\home\site\wwwroot\node_modules\mongodb-core\lib\connection\pool.js:477:5)
    at Socket.<anonymous> (D:\home\site\wwwroot\node_modules\mongodb-core\lib\connection\connection.js:331:22)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)

What did exactly the mongo authentication error here? Because I have try to connect from local to this remote database and it's connected without problem.

Thank you.

Upvotes: 1

Views: 401

Answers (1)

Rijdzuan Sampoerna
Rijdzuan Sampoerna

Reputation: 390

I solved it using cosmosdb from azure services. It seems the azure cosmosdb by default use ?ssl=true&replicaSet=globaldb

And I think that's the kind of authorization they want. Not just the user and password of db.

Upvotes: 0

Related Questions