Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

348
Views
socket.io-redis keeps throwing NOAUTH error

I am trying to connect to my redis server that password protected but for some reason I keep getting the error:

events.js:141 throw er; // Unhandled 'error' event ^ ReplyError: Ready check failed: NOAUTH Authentication required. at parseError (/home/ubuntu/TekIT/ITapp/node_modules/redis-parser/lib/parser.js:193:12) at parseType (/home/ubuntu/TekIT/ITapp/node_modules/redis-parser/lib/parser.js:303:14)

I know the password is correct because i tried it in the redis-cli and it works fine. Here is the code below:

var redis = require('redis');

var client = redis.createClient(redisPort, redisHostname, { auth_pass: 'password1' });


var redisSubscriber = redis.createClient(redisPort, redisHostname, { auth_pass: 'password1' });




// Create and use a Socket.IO Redis store
var RedisStore = require('socket.io-redis');
io.set('store', new RedisStore({
    redisPub: client,
    redisSub: redisSubscriber,
    redisClient: client
}));

Does anyone know why I am getting this error?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You should initialize socket.io-redis after ready event.

Also you should call to client.auth('password1', ()=>{}) function.

Check this part of documentation:

When connecting to a Redis server that requires authentication, the AUTH command must be sent as the first command after connecting. This can be tricky to coordinate with reconnections, the ready check, etc. To make this easier, client.auth() stashes password and will send it after each connection, including reconnections. callback is invoked only once, after the response to the very first AUTH command sent. NOTE: Your call to client.auth() should not be inside the ready handler. If you are doing this wrong, client will emit an error that looks something like this Error: Ready check failed: ERR operation not permitted.

Try this code:

var redis = require('redis');
const redisPort = 6379
const redisHostname = 'localhost'
const password = 'password1'

var p1 = new Promise((resolve, reject)=>{
    var client = redis.createClient(redisPort, redisHostname, { auth_pass: 'password1' });
    client.auth(password)
    client.on('ready', ()=>{
        resolve(client)
    })
})

var p2 = new Promise((resolve, reject)=>{
    var redisSubscriber = redis.createClient(redisPort, redisHostname, { auth_pass: 'password1' });
    redisSubscriber.auth(password)
    redisSubscriber.on('ready', ()=>{
        resolve(redisSubscriber)
    })
})

Promise.all([p1,p2]).then(([client, redisSubscriber])=>{
    console.log('done', client)
    client.ping((err, data)=>{
        console.log('err, data', err, data)
    })

    // Create and use a Socket.IO Redis store
    var RedisStore = require('socket.io-redis');
    io.set('store', new RedisStore({
        redisPub: client,
        redisSub: redisSubscriber,
        redisClient: client
    }));
})
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!