timisbusy / dumpstr

A node.js package to dump mongodb (mongodump) directly into s3 without filling up your local disk in the process.
MIT License
16 stars 6 forks source link

MongoError: auth fails #1

Open nabeel-ahmad opened 10 years ago

nabeel-ahmad commented 10 years ago

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' }
timisbusy commented 10 years ago

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?