When I am trying to use the MultiRegionRatelimit rate limiter, I am getting the following error:
ReferenceError: crypto is not defined
at MultiRegionRatelimit.limiter (/Users/jason/WORK/llegamus/node_modules/@upstash/ratelimit/script/multi.js:94:31)
at MultiRegionRatelimit.value (/Users/jason/WORK/llegamus/node_modules/@upstash/ratelimit/script/ratelimit.js:65:35)
This is because the crypto package is not imported before it is used during the multi region rate limiter. I think this is likely because Deno automatically imports the module, where other node runtimes do not.
I tried manually patching the package locally to import crypto and everything worked fine.
My specific setup is using Remix Dev Server and then hosting on Vercel's Serverless Functions. I don't think Vercel's Edge Functions would have this issue as it seems like they have support for the Web Crypto APIs.
When I am trying to use the
MultiRegionRatelimit
rate limiter, I am getting the following error:This is because the
crypto
package is not imported before it is used during the multi region rate limiter. I think this is likely because Deno automatically imports the module, where other node runtimes do not.I tried manually patching the package locally to import
crypto
and everything worked fine.My specific setup is using Remix Dev Server and then hosting on Vercel's Serverless Functions. I don't think Vercel's Edge Functions would have this issue as it seems like they have support for the Web Crypto APIs.