Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to use mSet command #2684

Closed
tungrix opened this issue Jan 5, 2024 · 1 comment
Closed

Fail to use mSet command #2684

tungrix opened this issue Jan 5, 2024 · 1 comment
Labels

Comments

@tungrix
Copy link

tungrix commented Jan 5, 2024

Description

I am trying to use the MSET command

const redisClient = await createClient({ url: REDIS_ENDPOINT })
  .on("error", (err) => console.log("Redis Client Error", err))
  .connect();

await  redisClient.mSet(["key1", 1, "key2", 2]);

Node.js Version

20.0.0

Redis Server Version

7.2

Node Redis Version

4.6.12

Platform

Linux

Logs

node:internal/process/esm_loader:40
       internalBinding('errors').triggerUncaughtException(
                                 ^
 
 TypeError: Invalid argument type
     at encodeCommand (/usr/src/app/node_modules/@redis/client/dist/lib/client/RESP2/encoder.js:17:19)
     at RedisCommandsQueue.getCommandToSend (/usr/src/app/node_modules/@redis/client/dist/lib/client/commands-queue.js:138:45)
     at Commander._RedisClient_tick (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:536:76)
     at Commander._RedisClient_sendCommand (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:523:82)
     at Commander.commandsExecutor (/usr/src/app/node_modules/@redis/client/dist/lib/client/index.js:190:154)
     at /usr/src/app/node_modules/@opentelemetry/instrumentation-redis-4/build/src/instrumentation.js:293:33
     at AsyncLocalStorage.run (node:async_hooks:346:14)
     at AsyncLocalStorageContextManager.with (/usr/src/app/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)
     at ContextAPI.with (/usr/src/app/node_modules/@opentelemetry/api/build/src/api/context.js:60:46)
     at RedisInstrumentation._traceClientCommand (/usr/src/app/node_modules/@opentelemetry/instrumentation-redis-4/build/src/instrumentation.js:292:39)
 
 Node.js v20.9.0
@tungrix tungrix added the Bug label Jan 5, 2024
@leibale
Copy link
Collaborator

leibale commented Jan 9, 2024

MSET expects an array of strings, this should work:

await  redisClient.mSet(['key1', '1', 'key2', '2']);

BTW, this works as well:

await  redisClient.mSet({
  key1: '1',
  key2: '2'
});

@leibale leibale closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants