Skip to content

Instantly share code, notes, and snippets.

@ktkaushik
Last active January 2, 2016 02:48
Show Gist options
  • Select an option

  • Save ktkaushik/8239307 to your computer and use it in GitHub Desktop.

Select an option

Save ktkaushik/8239307 to your computer and use it in GitHub Desktop.
Bull redis auth attempts
// Does not throw error connecting. Also, does not process jobs
var emailQueue =
Queue('email', 6379, 'SomeInstance.redis.irstack.com',
{ auth_pass: 'SomePassword' });
// because redisOptions is an array https://github.com/OptimalBits/bull#queuequeuename-redisport-redishost-redisopts
// throws an error while connecting
var emailQueue =
Queue('email', 6379, 'SomeInstance.redis.irstack.com',
[{ auth_pass: 'SomePassword' }]);
var redis = require('redis');
var emailQueue =
Queue('email');
emailQueue.client = redis.createClient(6379, 'SomeInstance.redis.irstack.com');
emailQueue.client.auth('SomePassword'); // https://github.com/mranney/node_redis#clientauthpassword-callback
// This is not really working either. The job never gets processed.
@manast
Copy link

manast commented Jan 3, 2014

ok, the first attempt should be the correct one. There is no really magic here, the options object is passed directly to the redis client. redisOptions is not an array, the [ ] means here that it is an optional parameter. Now it should be interesting to understand why is not processing jobs.

@ktkaushik
Copy link
Author

Look at attempt_3.js. I tried the auth() from the redis package.

Thats becuase emailQueue.client is the redis client

@manast
Copy link

manast commented Jan 6, 2014

It would be interesting to know if this is a problem related to password or something with the remote redis server. What version of redis are you using?

Copy link

ghost commented Aug 7, 2015

I'm using RedisCloud and the only way to authenticate is using the auth function

  function createClient() {
    var client;
    if(redisOptions !== undefined && redisOptions.createClient !== undefined){
      client = redisOptions.createClient();
    }else{
      client = redis.createClient(redisPort, redisHost, redisOptions);
    }
    client.auth("mypassword");
    return Promise.promisifyAll(client);
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment