fastify / fastify-rate-limit

A low overhead rate limiter for your routes
MIT License
477 stars 66 forks source link

Rate limit don't working even using async/await #362

Closed Snarloff closed 6 months ago

Snarloff commented 6 months ago

Prerequisites

Fastify version

4.26.0

Plugin version

9.1.0

Node.js version

20

Operating system

Windows

Operating system version (i.e. 20.04, 11.3, 10)

23H2

Description

Hello. I tried several ways to use the package, but in none of them the package is working for me. It does not assign headers to the request and does not block excessive requests.

Steps to Reproduce

Source Code

image

Expected Behavior

No response

Eomm commented 6 months ago

await plugins() must be run before adding routes.

It seems your app does not have routes between:

// do not add routes here

await plugins();

// add routes here

await app.listen()
Snarloff commented 6 months ago

await plugins() must be run before adding routes.

It seems your app does not have routes between:

// do not add routes here

await plugins();

// add routes here

await app.listen()

Thanks!