mongodbsails.jswaterline

sails-mongo auth error in sails 0.10


Using "sails-mongo": "^0.10.0-rc2", "sails": "~0.10.0-rc4" I'm getting the following error on sails lift.

verbose: Loading adapter ( sails-mongo ) for algorithm  from `node_modules` directory...
Failed to load c++ bson extension, using pure JS version
verbose: Starting ORM...
error: A hook (`orm`) failed to load!
error: MongoError: auth fails
    at Object.toError (/home/default/Projects/machine_learning_data_sets/machine-learning-    engine/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb/utils.js:110:11)
    at /home/default/Projects/machine_learning_data_sets/machine-learning-    engine/node_modules/sails-    mongo/node_modules/mongodb/lib/mongodb/auth/mongodb_cr.js:39:33
    at /home/default/Projects/machine_learning_data_sets/machine-learning-engine/node_modules/sails-mongo/node_modules/mongodb/lib/mongodb/db.js:1806:9
    at Server.Base._callHandler (/home/default/Projects/machine_learning_data_sets/machine-    learning-engine/node_modules/sails-    mongo/node_modules/mongodb/lib/mongodb/connection/base.js:442:41)
    at /home/default/Projects/machine_learning_data_sets/machine-learning-    engine/node_modules/sails-    mongo/node_modules/mongodb/lib/mongodb/connection/server.js:485:18
    at MongoReply.parseBody (/home/default/Projects/machine_learning_data_sets/machine-    learning-engine/node_modules/sails-    mongo/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
    at null.<anonymous> (/home/default/Projects/machine_learning_data_sets/machine-learning-    engine/node_modules/sails-        mongo/node_modules/mongodb/lib/mongodb/connection/server.js:443:20)
    at EventEmitter.emit (events.js:95:17)
    at null.<anonymous> (/home/default/Projects/machine_learning_data_sets/machine-learning-    engine/node_modules/sails-    mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:191:13)
    at EventEmitter.emit (events.js:98:17)
verbose: Lowering sails...
verbose: Sent kill signal to child process (12033)...
verbose: Shutting down socket server...
verbose: Shutting down HTTP server...

This is on a local mongodb that is reachable in the mongo console.

my connection is configured by

  mongo: {
    adapter   : 'sails-mongo',
    host      : 'localhost',
    port      : 27017,
    user      : '',
    password  : '',
    database  : 'mle'
  },

Solution

  • in my case i am using url for connect mongodb like below

    adapter: 'sails-mongo',
    url: 'mongodb://<USERNAME>:<PASSWORD>@<HOST>/<DATABASE>'