node-redis
node-redis copied to clipboard
Problem with running SCAN on ElastiCache Redis
Hello!
Issue
I'm having problems getting the SCAN command to run through node-redis on an ElastiCache Redis cluster. Here's a simple block of code that outputs all keys in the cache:
const redisClient = redis.createClient(process.env.CACHE_PORT, process.env.CACHE_HOST, {
retry_strategy: (options) => {
if (options.attempt > 10) {
return;
}
},
});
redisClient.scan(0, (error, result) => {
console.log(error);
console.log(result);
});
It works perfectly on my local machine, but on a lambda function that connects to ElastiCache - it does not produce any output. The function continues fine (it doesn't hang), but I can't see neither an error, nor a result.
I have no issues using node-redis
to run GET
and SET
commands.
I also tried logging onto the ElastiCache cluster using redis-cli. I executed scan 0
there (no arguments) and got the results back successfully.
The problem was first reported on issue #1314 (at the bottom) on 14 Jan 2020, so I assume this is not a recent problem.
Any help is appreciated. Thanks!
Environment
-
Node.js Version: Node.Js 12
-
Redis Version: 6.0.5 (ElastiCache), 6.0.9 (Locally)
-
node-redis Version: 3.1.2
- Platform: AWS Lambda, Mac OS X (Locally)