node-redis: 4.1.0 publish breaks when publishing an integer
This was working fine up until 4.0.6 but starting in version 4.1.0, publishing integers throws the following error.
/node_modules/@redis/client/dist/lib/client/RESP2/encoder.js:20
throw new TypeError('Invalid argument type');
^
TypeError: Invalid argument type
at encodeCommand (/node_modules/@redis/client/dist/lib/client/RESP2/encoder.js:20:19)
at RedisCommandsQueue.getCommandToSend (/node_modules/@redis/client/dist/lib/client/commands-queue.js:187:45)
at Commander._RedisClient_tick (/node_modules/@redis/client/dist/lib/client/index.js:429:76)
at Commander._RedisClient_sendCommand (/node_modules/@redis/client/dist/lib/client/index.js:413:82)
at Commander.commandsExecutor (/node_modules/@redis/client/dist/lib/client/index.js:167:154)
at Commander.BaseClass.<computed> [as publish] (/node_modules/@redis/client/dist/lib/commander.js:8:29)
Environment:
- Node.js Version: 16
- Redis Server Version: 4
- Node Redis Version: 4.1.0
- Platform: Ubuntu
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 8
- Comments: 18
Commits related to this issue
- redis: Invalid argument type error 해결 https://github.com/redis/node-redis/issues/2116 — committed to joyfulprogrammers/jakshim-backend by deleted user 2 years ago
I got the same error. It works for me adding createClient option(
legecyMode: true) andconnect()together.This is a serious error 😦
In this version 4.1.0, Date values are not working anymore too . Before, they worked fine.
I’m not sure if I follow this thoroughly. Publishing integer values has worked for the longest time until 4.1.0. Are we saying that publishing integers is no longer supported?
redisPubClient.publish('channel', 1)used to work but now has to be written asredisPubClient.publish('channel', '1')@dragonlobster for while, convert to string every value on or before command db.set… when you to execute command get, convert the returned string to correct datatype…