Uncaught Error: Disallowed operation called within global scope #35
-
I created a middleware: emailRateLimiter: import { rateLimiter } from 'hono-rate-limiter';
export const emailRateLimiter = rateLimiter({
windowMs: 15 * 60 * 1000,
limit: 5,
standardHeaders: 'draft-6',
keyGenerator: (c) => c.req.url
}); then im trying to use it (in conjunction with app
.openapi(
createRoute({
method: 'post',
path: '/users/code',
request: {
// --
},
responses: {
// --
},
middleware: [emailRateLimiter],
}),
async (c) => {
// --
}
},
) which results in
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Interesting, I haven't tried it with |
Beta Was this translation helpful? Give feedback.
-
The issue is you are running this in Cloudflare env, either |
Beta Was this translation helpful? Give feedback.
The issue is you are running this in Cloudflare env, either
workers
orpages
. You will have to pass a store as by default it uses a memory store that cannot run in Cloudflare. If you want to use Cloudflare infra as a store, you can look into this https://www.npmjs.com/package/@hono-rate-limiter/cloudflare.