Failing to connect to hosted redis: Ready check failed: ERR operation not permitted

Failing to connect to hosted redis: Ready check failed: ERR operation not permitted

Problem

I’m trying to connect to a hosted redis on IrisCouch that I provisioned via Nodejitsu.

What I think are the relevant parts of my server.js :

var redisUrl = require('url').parse(config.REDIS_CONNECTION_URI);
var client = require('redis').createClient(redisUrl.port, redisUrl.hostname);

I don’t have any interaction with the client in my server.js yet, which is why I think it’s weird that it’s throwing the “operation not permitted”, since basicly the only operation I do is to connect. I don’t have a redis.conf file and I believe I shouldn’t need one since I do not host the redis instance myself.

Log:

 Express server listening on port 3000

/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:504
                throw callback_err;
                      ^
Error: Ready check failed: ERR operation not permitted
    at RedisClient.on_info_cmd (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:317:35)
    at Command.RedisClient.ready_check.send_anyway [as callback] (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:365:14)
    at RedisClient.return_error (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:500:25)
    at ReplyParser.RedisClient.init_parser (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:260:14)
    at ReplyParser.EventEmitter.emit (events.js:96:17)
    at ReplyParser.send_error (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/lib/parser/javascript.js:293:10)
    at ReplyParser.execute (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/lib/parser/javascript.js:176:22)
    at RedisClient.on_data (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:476:27)
    at Socket.<anonymous> (/Users/soroushhakami/dev/projects/projectx/node_modules/redis/index.js:79:14)
    at Socket.EventEmitter.emit (events.js:96:17)

Any ideas on what could be the problem?

Problem courtesy of: Soroush Hakami

Solution

You need to call client.auth() directly after creating the client:

var client = require('redis').createClient(redisUrl.port, redisUrl.hostname);
client.auth(PASSWORD);

The confusing thing is that when you don’t call .auth() on client but nothing else either, you will get a failed ready check error.

Solution courtesy of: robertklep

Discussion

Leave a Reply

Your email address will not be published. Required fields are marked *