Next.js Discord

Discord Forum

build failed on Vercel due to use of bloom filter in middleware

Unanswered
Encyrtid wasp posted this in #help-forum
Open in Discord
Encyrtid waspOP
i am following this repo to create redirects, just the difference is that i have used javascript - https://github.com/vercel/examples/blob/main/edge-middleware/redirects-bloom-filter/middleware.ts

i have attached my middleware file code in screenshot, when i deploy to vercel it gives below error

Creating an optimized production build ...
Failed to compile.
./middleware.js
Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation
The error was caused by importing 'bloom-filters/dist/api.js' in './middleware.js'.
Import trace for requested module:
./middleware.js
Build failed because of webpack errors
Error: Command "npm run build" exited with 1

2 Replies

Original message was deleted
Asian black bear
Don't ping the mods for troubleshooting help, only for actual moderation issues.
Encyrtid waspOP
okay fine