Closed islam3rafah closed 1 year ago
Hi @islam3rafah,
Do you have the corresponding datasource defined with the dataSourceName
property set to redis
?
Can you share the @loopback/core
's package version you're using?
Also the RatelimitActionMiddleware: true,
should be bound to RateLimitSecurityBindings.RATELIMITCONFIG
as in your config it's mixed with general config.
yeah sorry, I copied the wrong version, I reverted it so it is now like that: ` this.bind(RateLimitSecurityBindings.RATELIMITCONFIG).to({ RatelimitActionMiddleware: true, }); this.bind(RateLimitSecurityBindings.CONFIG).to({ name: 'redis', type: 'RedisStore', windowMs: 10 * 1000, max: 3, message: "limit reached", standardHeaders: true });
this.component(RateLimiterComponent as any);`
Seems the LoopBack version you're using is quite old. Can you try using v4.1.2 of the loopback4-ratelimiter
along with your current LoopBack version or update LoopBack versions (See https://loopback.io/doc/en/lb4/Update-generator.html) to use the latest release of this extension and see if that solves your issue.
If it persists please help me by providing a minimal reproduction of the issue on https://codesandbox.io/.
I really appreciate your support and consideration. this is a sample minimal project that still has the same problem after using new version of loopback core and the ratelimiter. the only rest api is the ping api.
Thanks for providing the reproduction @islam3rafah, the quick (but not-recommended) workaround would be to move the binding below the this.component
statement. Due to the config options being set to null in the existing extension code which makes it inaccessible to the actual handlers.
I've raised a PR #117 fixing the same and can be expected to be merged and release real soon.
Thanks for raising the issue.
This issue has been resolved in version 5.0.1 🎉
Thank you so much, I tried 5.0.1 and it worked fine
I am using the following configuration in application.ts but I am getting that The key 'datasources.undefined' is not bound to any value in context: