How to use database actions in middleware?
Answered
Siberian posted this in #help-forum
SiberianOP
Hi, I want to use the
Thanks in advance.
ioredis
package in a rate-limiting middleware I'm constructing. But I'm encountering the runtime error:TypeError: Cannot read properties of undefined (reading 'charCodeAt')
Thanks in advance.
Answered by B33fb0n3
you can't use that package on the edge middleware. However, you can create an endpoint and fetch that endpoint from your middleware. The nextjs team is working on a nodejs middleware. It will be stable soon
3 Replies
@Siberian Hi, I want to use the `ioredis` package in a rate-limiting middleware I'm constructing. But I'm encountering the runtime error:
TypeError: Cannot read properties of undefined (reading 'charCodeAt')
Thanks in advance.
you can't use that package on the edge middleware. However, you can create an endpoint and fetch that endpoint from your middleware. The nextjs team is working on a nodejs middleware. It will be stable soon
Answer
happy to help