I have nodejs app which needs to connect to Redis database. However, when trying to connect to Redis it always returns "false". I have running Redis instance on the same machine which is accessible from cli, also have another nodejs app which is connected to this same instance of Redis.
I don'g see anything wrong in /var/log/redis/redis-server.log nor printed in the console.
Any ideas what might be the issue?
$ nodejs -v v8.11.1
$redis-server -v Redis server v=4.0.9 sha=00000000:0 malloc=jemalloc-3.6.0 bits=64 build=1bc80a08306a3efd
const redis = require('redis'),
redisClient = redis.createClient(6379, '127.0.0.1');
const REDIS_USER_DATA_INDEX = 2;
redisClient.select(REDIS_USER_DATA_INDEX);
redisClient.on('connect', function () {
console.log('redis connected');
}).on('error', function (error) {
console.log(error);
});
console.log(`connected ${redisClient.connected}`);
EDIT I'm not getting any events in both redisClient.on() callbacks