Skip to content

MULTI does not handle commands "runtime" errors #2665

Closed
@LiraNuna

Description

@LiraNuna

Description

When using XAUTOCLAIM on a non-existant key, a TypeError is raised because the result is incorrectly mapped.

To reproduce:

const redis = require("redis");

async function reproduceBug() {
    const redisClient = redis.createClient();
    await redisClient.connect();

    return await redisClient.multi()
        .XAUTOCLAIM('does-not-exist', 'group', 'test', 15000, '0')
        .exec();
}

reproduceBug();

I believe the issue stems from transformReply not handling the exception when it comes through, but it could also be a problem with handleExecReplies not detecting the error.

Node.js Version

Any

Redis Server Version

Any

Node Redis Version

4.6.11

Platform

Any

Logs

node bug.js
node_modules/@redis/client/dist/lib/commands/generic-transformers.js:87
    return reply.map(transformStreamMessageNullReply);
                 ^

TypeError: Cannot read properties of undefined (reading 'map')
    at transformStreamMessagesNullReply (node_modules/@redis/client/dist/lib/commands/generic-transformers.js:87:18)
    at transformReply (node_modules/@redis/client/dist/lib/commands/XAUTOCLAIM.js:17:79)
    at node_modules/@redis/client/dist/lib/multi-command.js:67:37
    at Array.map (<anonymous>)
    at RedisMultiCommand.transformReplies (node_modules/@redis/client/dist/lib/multi-command.js:65:27)
    at RedisMultiCommand.handleExecReplies (node_modules/@redis/client/dist/lib/multi-command.js:62:21)
    at Commander.exec (node_modules/@redis/client/dist/lib/client/multi-command.js:81:82)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async reproduceBug (bug.js:7:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions