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

MongoDB Atlas Connection to Loopback #511

Closed
kthecoder opened this issue Apr 27, 2019 · 4 comments
Closed

MongoDB Atlas Connection to Loopback #511

kthecoder opened this issue Apr 27, 2019 · 4 comments

Comments

@kthecoder
Copy link

kthecoder commented Apr 27, 2019

Description/Steps to reproduce

Using Loopback 3.x with loopback-connector-mongodb
I tried defining:

  "db": {
           "url": "mongodb+srv://...",
           "connector": "loopback-connector-mongodb"
      }

In the databasesources.json but I keep getting the error:

Connection fails: MongoError: Authentication failed.
It will be retried for the next request.
C:\Users \lms\node_modules\mongodb\lib\topologies\replset.js:368
              throw err;
              ^

MongoError: Authentication failed.
    at Function._getError (C:\Users \lms\node_modules\mongodb-core\lib\auth\scram.js:125:14)
    at sendAuthCommand (C:\Users \lms\node_modules\mongodb-core\lib\auth\scram.js:175:31)
    at Connection.messageHandler (C:\Users \lms\node_modules\mongodb-core\lib\connection\connect.js:334:5)
    at Connection.emit (events.js:189:13)
    at processMessage (C:\Users \lms\node_modules\mongodb-core\lib\connection\connection.js:364:10)
    at TLSSocket.<anonymous> (C:\Users \lms\node_modules\mongodb-core\lib\connection\connection.js:533:15)
    at TLSSocket.emit (events.js:189:13)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at TLSSocket.Readable.push (_stream_readable.js:220:10)
    at TLSWrap.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
Emitted 'error' event at:
    at DataSource.postInit (C:\Users \lms\node_modules\loopback-datasource-juggler\lib\datasource.js:480:16)
    at C:\Users \lms\node_modules\loopback-connector-mongodb\lib\mongodb.js:320:23
    at err (C:\Users \lms\node_modules\mongodb\lib\utils.js:411:14)
    at executeCallback (C:\Users \lms\node_modules\mongodb\lib\utils.js:401:25)
    at err (C:\Users \lms\node_modules\mongodb\lib\operations\mongo_client_ops.js:285:21)
    at connectCallback (C:\Users \lms\node_modules\mongodb\lib\operations\mongo_client_ops.js:265:5)
    at topology.connect (C:\Users \lms\node_modules\mongodb\lib\operations\mongo_client_ops.js:413:14)
    at ReplSet.<anonymous> (C:\Users \lms\node_modules\mongodb\lib\topologies\replset.js:364:11)
    at Object.onceWrapper (events.js:277:13)
    at ReplSet.emit (events.js:189:13)
    at C:\Users \lms\node_modules\mongodb-core\lib\topologies\replset.js:609:23
    at Server.<anonymous> (C:\Users \lms\node_modules\mongodb-core\lib\topologies\replset.js:336:9)
    at Object.onceWrapper (events.js:277:13)
    at Server.emit (events.js:189:13)
    at Pool.<anonymous> (C:\Users \lms\node_modules\mongodb-core\lib\topologies\server.js:452:12)
    at Pool.emit (events.js:189:13)

Expected result

Expected a connection to MongoDB database.

Additional information

win32 x64 10.15.3

+-- loopback@3.25.1
+-- loopback-boot@2.28.0
+-- loopback-component-explorer@6.3.1
+-- loopback-connector-mongodb@4.1.0

@dhmlau
Copy link
Member

dhmlau commented Apr 27, 2019

@kg551915, there was a PR got merged related to connecting with mongodb+srv protocol: #497, which might fix your issue. We're planning to make a release soon.

@kthecoder
Copy link
Author

In the meantime, is there another way to connect to Atlas?

@dhmlau
Copy link
Member

dhmlau commented May 1, 2019

@b-admike, I know you have 2 PRs that you want to land soon, just wondering if we'd be able to release this week. There are a few people already waiting for the mongodb+srv protocol fix. I'm thinking whether it makes sense to make a release without your PRs.

@dhmlau
Copy link
Member

dhmlau commented May 5, 2019

@kg551915, loopback-connector-mongodb@4.2.0 was released 2 days ago. Could you please try again to see if it fixes your problem? Thanks.

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

No branches or pull requests

2 participants