Skip to content

missing parameters are silently converted to an empty string #1898

Closed
@Flarna

Description

@Flarna

If I use wrong number of arguments like set("foo") no error/failure is reported instead an empty string is written to redis.

Seems to be caused by the changed done in #1849.

Before the change above I got following exception which is also not that nice but at least no silent overwrite.

TypeError: Cannot read property 'length' of undefined
    at encodeCommand (C:\work\redis-4\node_modules\@node-redis\client\dist\lib\commander.js:71:104)
    at encodeCommand.next (<anonymous>)
    at RedisSocket.writeCommand (C:\work\redis-4\node_modules\@node-redis\client\dist\lib\client\socket.js:56:20)
    at Commander._RedisClient_tick (C:\work\redis-4\node_modules\@node-redis\client\dist\lib\client\index.js:435:64)
    at Commander._RedisClient_sendCommand (C:\work\redis-4\node_modules\@node-redis\client\dist\lib\client\index.js:416:82)
    at Commander.commandsExecutor (C:\work\redis-4\node_modules\@node-redis\client\dist\lib\client\index.js:166:154)
    at Commander.BaseClass.<computed> [as set] (C:\work\redis-4\node_modules\@node-redis\client\dist\lib\commander.js:8:29)
    at test (C:\work\redis-4\test.js:15:22)

I would expect to get an error like ERR wrong number of arguments for 'set' command like in redis-cli.

Environment:

  • Node.js Version: 14.19.0
  • Redis Server Version: 2.8.2400
  • Node Redis Version: 4.0.3
  • Platform: Windows 10

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