RedisStore throws error when client object is passed
See original GitHub issueconst client = createClient();
const requestLimiter = rateLimit({
store: new RedisStore({
client
}),
windowMs: 1 * 60 * 1000 * 60, // 1h
max: 100, // Limit IP to 100 requests per hour
message: "Request limit exceeded! try again in a short while",
});
Throws the following error:
TypeError: options.client.multi(...).incr(...).pttl is not a function
Any solution please? I need to use the redis container in my docker network
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (2 by maintainers)
Top Results From Across the Web
Redis NodeJs server error,client is closed - Stack Overflow
I am getting above error when user sends a message to the room or when socket.on("sendMessage") is called. Where am I going wrong?...
Read more >Problem in connection to RedisStorage · Issue #808 - GitHub
My call to set the RedisStore was generating an unauthorized error, even though I was passing in authorized clients. It turned out that...
Read more >Redis client connects to the redis remote server but can't read ...
I've to manage two servers 'Node_server' and a redis server 'Redis_server' by making the connection possible from a node/express application ...
Read more >Session Management in Nodejs Using Redis as Session Store
Create express-session and pass it to connect-redis object as parameter. This will initialize it. Then in session middleware, pass the Redis ...
Read more >Session handling in Express Using Redis | Code for geek
Create express-session and pass it to connect-redis object as parameter. This will initialize it. Then in session middleware, pass the Redis store information ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jesseinvent I think this should be left open as an issue. This project needs updating to account for the version of client that might be passed in - right now it will use it as if it were a v3 client even if it is not.
Hi,
I recently helped out with the Typescript rewrite (PR #43), which also changes how the store interacts with Redis - v3.0.0 (~will be released soon!~ released!) accepts the
sendCommand
option instead of theclient
option.sendCommand
is a (sync/async) function that takes the raw command as an array ofstring
s and returns thenumber
orstring
response from redis. This makes the store compatible with all clients that have a public method to send raw commands to redis.Please do take a look at the readme for examples of using the store with Redis and IORedis clients. The value to be passed for
sendCommand
option is also given here for most Redis clients.