Yêu cầu thg 7 26, 2022 10:35 CH 529 0 1
  • 529 0 1
+1

LỖI NOAUTH Authentication required.

Chia sẻ
  • 529 0 1

Như tiêu đề, e bị lỗi đặr pass cho redis nhưng bị báo lỗi Noauth. Nên em chuyển pass về null. Pro nào có thể chỉ giáo e cách khắc phục lỗi này và đặt pass no Nopejs redis.

Shutdown uncaughtException ReplyError: Ready check failed: NOAUTH Authentication required. at parseError (/usr/src/app/node_modules/socket.io-redis/node_modules/redis-parser/lib/parser.js:179:12) at parseType (/usr/src/app/node_modules/socket.io-redis/node_modules/redis-parser/lib/parser.js:302:14) { command: 'INFO', code: 'NOAUTH' }

'use strict';

const redis = require('redis');
const config = require('../config');

exports.getClient = function (storeDb) {
    const store = redis.createClient({
        host: config.REDIS_HOST,
        port: config.REDIS_PORT,
        auth_pass: null
    });

    store.select(storeDb);
    store.on('error', function (err) {
        console.error('Redis error: ' + err);
    });

    process.on('exit', function (code) {
        console.log('Exit with code:', code);
        // store.flushdb(); //TODO Why we need this 1?
    });
    return store;
};

1 CÂU TRẢ LỜI


Đã trả lời thg 7 27, 2022 2:25 SA
0

của mình vẫn bình thường mà bạn:

const redis = require('redis');

const client = redis.createClient({
    host: '<hostname>',
    port: <port>,
    password: '<password>'
});

Nếu bạn để các thông tin connect tới redis trong biến môi trường thì đảm bảo là nó có giá trị nhé, console.log ra để check

Bạn cần check để chắc chắn bạn đã enable auth cho redis thành công: ở terminal chạy: redis-cli -a <password>, nếu connect vào và ko gặp lỗi NOAUTH thì ok, thử chạy 1 vài redis commands xem nhé

Chia sẻ
Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí