question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid argument type when trying to pass EX into set function

See original GitHub issue

When I try to set an expiration on my key redis throws a TypeError: Invalid argument error. I’ve basically copied the docs.

Environment:

  • Node.js Version: v18.12.0
  • Redis Server Version: 6.2.7
  • Node Redis Version: 4.5.1
  • Platform: Fedora 34
await redisClient.set(`test`, `test`); // Works

await redisClient.set(`test`, `test`, {}); // Does not work

await redisClient.set(`test`, `test`, { // Does not work
    EX: 10,
  });

Error: /home/gustaf/projekt/random-website/server/node_modules/redis/node_modules/@redis/client/dist/lib/client/RESP2/encoder.js:17 throw new TypeError('Invalid argument type'); ^ TypeError: Invalid argument type at encodeCommand (/home/gustaf/projekt/random-website/server/node_modules/redis/node_modules/@redis/client/dist/lib/client/RESP2/encoder.js:17:19) at RedisCommandsQueue.getCommandToSend (/home/gustaf/projekt/random-website/server/node_modules/redis/node_modules/@redis/client/dist/lib/client/commands-queue.js:187:45) at Commander._RedisClient_tick (/home/gustaf/projekt/random-website/server/node_modules/redis/node_modules/@redis/client/dist/lib/client/index.js:440:76) at Commander._RedisClient_sendCommand (/home/gustaf/projekt/random-website/server/node_modules/redis/node_modules/@redis/client/dist/lib/client/index.js:424:82) at Commander.sendCommand (/home/gustaf/projekt/random-website/server/node_modules/redis/node_modules/@redis/client/dist/lib/client/index.js:375:93) at Commander.<computed> (/home/gustaf/projekt/random-website/server/node_modules/redis/node_modules/@redis/client/dist/lib/client/index.js:412:27) at forgotPassword (/home/gustaf/projekt/random-website/server/src/gql/resolvers/endpoints/user/forgot-password.ts:18:21) at async UserResolver.forgotPassword (/home/gustaf/projekt/random-website/server/src/gql/resolvers/endpoints/user/index.ts:61:14) at async dispatchHandler (/home/gustaf/projekt/random-website/server/node_modules/type-graphql/dist/resolvers/helpers.js:83:24) at async /home/gustaf/projekt/random-website/server/node_modules/type-graphql/dist/resolvers/helpers.js:84:26

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
Hardekerliscommented, Dec 7, 2022

Sorry for late response. The attached script above with EX passed in an object worked. What I think happened is that I forgot to save my file when I removed legacy mode from the create client config…

0reactions
simonprickettcommented, Dec 7, 2022

Closing this issue as it has been resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

R - bare to quosure in function - invalid argument type
I get a "Error in !x : invalid argument type" error when I run the code ... Try to unquote !!x and !!y...
Read more >
Power Apps Troubleshooting Error Messages - YouTube
13:03 Incompatible Type 15:54 PatchIsPicky - The function Patch has some invalid arguments 22:28 IDon'tBelieveYou - Don't try so hard or ...
Read more >
Solved: Re: Sharepoint patch invalid argument (table)
What I'm getting as my error though is: Invalid argument type (table). Expected a Record value instead. Once I am able to get...
Read more >
How to fix: "TypeError: Incorrect number of arguments or ...
This error is thrown when you try to call a function with the wrong number of arguments, or when you try to pass...
Read more >
invalid arguments - Maple Help - Maplesoft
This error occurs when an argument of an incorrect type is passed to a command. The type of arguments accepted by Maple commands...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found