Skip to content

Unwanted console output when calling scan & scanIterator functions #3036

@siroossheikhi

Description

@siroossheikhi

Description

Hello,
I'm using Redis as Cache layer for my project and used node-redis package to connect to Redis server.
After updating node-redis to newer version (5.6.1) I realized that some unwanted output shown on console when call "scan" and "scanIterator" functions.
Somethings like below text:

eeeeeeeeee [ 'SCAN', '0', 'COUNT', '100', 'TYPE', 'string' ]

After messing around with my codes and also node-redis source codes I found out there is two unwanted "console.log" in SCAN.ts file within node-redis package.
You can find the SCAN.ts file source code here:

https://github.com/redis/node-redis/blob/master/packages/client/lib/commands/SCAN.ts

I mention the section of code which shown unwanted output on console:

exports.default = {
    NOT_KEYED_COMMAND: true,
    IS_READ_ONLY: true,
    /**
     * Constructs the SCAN command
     *
     * @param parser - The command parser
     * @param cursor - The cursor position to start scanning from
     * @param options - Scan options
     * @see https://redis.io/commands/scan/
     */
    parseCommand(parser, cursor, options) {
        parser.push('SCAN');
        parseScanArguments(parser, cursor, options);
        if (options?.TYPE) {
            parser.push('TYPE', options.TYPE);
        }
        console.log('eeeeeeeeee', parser.redisArgs); <----------Unwanted console.log
    },
    /**
     * Transforms the SCAN reply into a structured object
     *
     * @param reply - The raw reply containing cursor and keys
     * @returns Object with cursor and keys properties
     */
    transformReply([cursor, keys]) {
        console.log(cursor, keys); <----------Unwanted console.log
        return {
            cursor,
            keys
        };
    }
};

Node.js Version

20.11.1

Redis Server Version

8.0.3

Node Redis Version

5.6.1

Platform

Windows

Logs

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions