-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
- If create a user that has no permissions to run the
monitorcommand
$ redis-cli
localhost:6379> ACL SETUSER alice on nopass ~* &* +@all -monitor
OK- Connect to Redis and call monitor function
const Redis = require("ioredis");
var redis = new Redis({host: 'localhost', port: 6379, username: 'alice'});
redis.on("connect", () => {
console.log('Connected to DB \n');
redis.monitor((err, monitor) => {
console.log('Error', err)
if (!err) {
monitor.on('monitor', (...args) => console.log(JSON.stringify(args)))
}
});
});- As a result in the callback function we don't see any error and Node.js process just crushes (the same behavior for
asyncfunction implementation)
Connected to DB
Error null
node_modules\redis-parser\lib\parser.js:179
return new ReplyError(string)
^
ReplyError: NOPERM this user has no permissions to run the 'monitor' command or its subcommand
at parseError (node_modules\redis-parser\lib\parser.js:179:12)
at parseType (node_modules\redis-parser\lib\parser.js:302:14) {
command: { name: 'monitor', args: [] }
}
Is it possible to handle such cases and properly throw errors without stopping the Node.js process?