Closed mathysth closed 5 months ago
Hey, can you please provide me a reproduction of this, like on CodeSandbox or Stackblitz?
Hey it will take sometime so I will give you instead the file url, i'm also using bun.sh here
I tried creating a sample app, using pnpm. It did work out of the box (the rate-limiting stuff), but there is a type error. The error message is
Type 'ConfigType<any, any, {}>' is missing the following properties from type 'Options': legacyHeaders, validate
hono-rate-limiter
doesn't support legacyHeaders
and validate
properties, as these are something that express-rate-limit
itself suggests to void use for newer applications. So to avoid the type errors, we can do this
const limiter = rateLimiter({
windowMs: 60 * 1000, // 1 minute
limit: 5,
standardHeaders: "draft-6", // draft-6: `RateLimit-*` headers;
keyGenerator: (c) => {
return "<unique_key>";
},
store: new RedisStore({
sendCommand: (...args: string[]) => redisClient.sendCommand(args),
}) as unknown as Store // Adding the correct type
});
It's working for me thanks for the help
I'm trying to use
rate-limit-redis
but it's not working and compiling because of theredisStore
. Has the readme said I could use this store but I can't because of this error:Here my setup