Closed joaosilva0345 closed 2 months ago
Hey @joaosilva0345! 👋🏻
Import limiter inside the callback, not at the top of the file.
@RomainLanz How about removing the route configuration from the config file and instead provide a programmatic API for the same? Something like.
transmit.configureRoute((route) => {
})
This way this code could live in start/transmit.ts
file
Yeah, that would be a nice addition
Hey @joaosilva0345! 👋🏻
Import limiter inside the callback, not at the top of the file.
Hi Thank you for the solution! I followed your suggestion to import the limiter inside the callback, and it worked perfectly.
I really thought I had already tested this approach, but I was mistaken. I went through several different attempts at solutions, and the correct one was right in front of me.
Thank you again for your help!
Package version
1.0.2
Describe the bug
I am facing an issue when using the Transmit package along with the Limiter in AdonisJS 6. Below is a detailed description of the problem and the relevant code:
In the
config/transmit.ts
file, I am trying to add throttle using therouteHandlerModifier()
method as per the documentation:However, on the line
route.use(throttle)
, I am encountering the following error:Below is the code from the
start/limiter.ts
file:The throttle works perfectly fine on routes defined in
start/routes.ts
, but when trying to use it inconfig/transmit.ts
, the above error is thrown.Could you please help me understand what is causing this issue? Is there any modification needed in the code or configuration to resolve this error?
Thank you in advance for your help!
Reproduction repo
No response