fastify/fastify-rate-limit

Rate limit don't working even using async/await

Closed this issue · 2 comments

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

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

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()

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!