Baroshem / nuxt-security

🛡 Automatically configure your app to follow OWASP security patterns and principles by using HTTP Headers and Middleware
https://nuxt-security.vercel.app/
MIT License
818 stars 56 forks source link

Error when using nuxt-security with nuxt3 nitro preset cloudflare #197

Closed CurryAyam closed 1 year ago

CurryAyam commented 1 year ago

Version

Reproduction Link

Steps to reproduce

after installing nuxt-security and add to nuxt.config.js do a yarn build and use wrangler to test the deployement wrangler dev .output/server/index.mjs --site .output/public --local

What is Expected?

What is actually happening?

[mf:inf] Ready on http://127.0.0.1:8787/
[nuxt] [request error] [unhandled] [500] Cannot convert object to primitive value
  at core:user:daundewa:4403:25  
  at getMilliseconds (core:user:daundewa:4406:8)  
  at new TokenBucket (core:user:daundewa:4436:67)  
  at new RateLimiter (core:user:daundewa:4472:28)  
  at Object.handler (core:user:daundewa:4593:22)  
  at Object.handler (core:user:daundewa:3010:33)  
  at async core:user:daundewa:3053:11  
  at async core:user:daundewa:5106:20  
  at async jsonError (core:user:daundewa:233:14)
[nuxt] [request error] [unhandled] [500] Cannot convert object to primitive value
  at core:user:daundewa:4403:25  
  at getMilliseconds (core:user:daundewa:4406:8)  
  at new TokenBucket (core:user:daundewa:4436:67)  
  at new RateLimiter (core:user:daundewa:4472:28)  
  at Object.handler (core:user:daundewa:4593:22)  
  at Object.handler (core:user:daundewa:3010:33)  
  at async core:user:daundewa:3053:11  
  at async Object.localFetch (core:user:daundewa:5058:24)  
  at async Object.errorHandler$1 [as onError] (core:user:daundewa:4379:81)  
  at async core:user:daundewa:3056:70
[mf:inf] GET / 500 Internal Server Error (22ms)
[nuxt] [request error] [unhandled] [500] Cannot convert object to primitive value
  at core:user:daundewa:4403:25  
  at getMilliseconds (core:user:daundewa:4406:8)  
  at new TokenBucket (core:user:daundewa:4436:67)  
  at new RateLimiter (core:user:daundewa:4472:28)  
  at Object.handler (core:user:daundewa:4593:22)  
  at Object.handler (core:user:daundewa:3010:33)  
  at async core:user:daundewa:3053:11  
  at async core:user:daundewa:5106:20  
  at async jsonError (core:user:daundewa:233:14)
[mf:inf] GET /favicon.ico 500 Internal Server Error (7ms)
Baroshem commented 1 year ago

Hey @CurryAyam

This issue is actually a Duplicate of https://github.com/Baroshem/nuxt-security/issues/137

It is caused by rate limiting middleware.

Can you try to disable it to see if it works correctly?

CurryAyam commented 1 year ago

Oh, my apology i didn’t browse it before i posted. i actually need the rate limitting stuff!

Thank you for the assistance

On 14 Aug 2023, at 03:10, Jakub Andrzejewski @.***> wrote:

Hey @CurryAyam https://github.com/CurryAyam This issue is actually a Duplicate of #137 https://github.com/Baroshem/nuxt-security/issues/137 It is caused by rate limiting middleware.

Can you try to disable it to see if it works correctly?

— Reply to this email directly, view it on GitHub https://github.com/Baroshem/nuxt-security/issues/197#issuecomment-1676452143, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVBIP3AL7OUXOF7ENXLOVNLXVEYBXANCNFSM6AAAAAA3O2LIPI. You are receiving this because you were mentioned.

Baroshem commented 1 year ago

@CurryAyam

I am planning to deprecate this built in rate limiter because of the issues that this middleware is causing to several types of web applications. If you are looking for a proper rate limiting solution, I would recommend to check tools that operate on the infrastructure layer rather than on application layer

Baroshem commented 1 year ago

Any more info here @CurryAyam ?

I would like to help but at this point I am not sure if it can be done as it is caused by the underlying rate limiting library.

CurryAyam commented 1 year ago

Hi jakub,

I got all the info i got! I have to change something on my nuxt app! Thank you so much for the help

On Mon, 21 Aug 2023 at 17:14 Jakub Andrzejewski @.***> wrote:

Any more info here @CurryAyam https://github.com/CurryAyam ?

I would like to help but at this point I am not sure if it can be done as it is caused by the underlying rate limiting library.

— Reply to this email directly, view it on GitHub https://github.com/Baroshem/nuxt-security/issues/197#issuecomment-1686047030, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVBIP3EGW3YY36DHKXVO2GDXWMYJBANCNFSM6AAAAAA3O2LIPI . You are receiving this because you were mentioned.Message ID: @.***>

Baroshem commented 1 year ago

Ok, I am closing the ticket then.

If you would need any additional help or info, do not hesitate to create a discussion or issue :)