dumpstr
dumpstr copied to clipboard
MongoError: auth fails
This module is very useful but strangely I can't get it to work on Heroku. It works when I use it on localhost. But when I deploy on heroku I get Mongo authentication error. Even though the Mongo URI is the same as the one I'm using with Mongoose. I also tried by hard coding the mongo db URL with auth credentials on localhost and it worked. But for some strange reason it does not work on Heroku
// Data backups
exports.backupData = function () {
var now = +new Date(); // gives the current time as a number
console.log("Data backup initiated.");
dump(config.mongoURL, "backup-" + now, function (err, res) {
if (err) {
console.error("Data backup failed.", err);
}
else console.log('Data backup results: ', res);
});
};
Here's the error
{ [MongoError: auth fails] name: 'MongoError', code: 18, ok: 0, errmsg: 'auth fails' }
Sorry not to be in touch for a bit. I haven't tried deploying to Heroku. Does the error occur right away when dumpstr is connecting to get the collections or later in the mongodump phase?