Bug with Next.js Edge runtime on 3.0.4
Bug report
After upgrading to 3.0.4 from 3.0.2, the build fails with the following error:
Failed to compile.
./middleware.ts
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.ts'.
Import trace for requested module:
./middleware.ts
Versions
Next.js: 14.2.13 Node: 22.12
Thank you for the report. Do you have other information about the error? A specific package identified as the root cause of the problem? We updated 2 dependencies since 3.0.2 but also there are a few other sub-dependencies that have been updated in the yarn.lock. Maybe one of them is now using some wasm now.
@folkvir thanks for checking this out. Do you have any suggestions for testing which package it is? The logs I provided are the only ones I've managed to gather so far
No I don't. I only have the diff between our 2 package versions. We will have to dig into every updated package... https://github.com/Callidon/bloom-filters/compare/v3.0.2...v3.0.4
I've encountered this as well. I will try to do some testing to find out which package is the cause
Did you guys ever find a solution ?
No unfortunately still occurring. v3.0.1 was working for me previously
After some digging, I discovered that this issue occurs when upgrading to NextJS v15, which is why Vercel's example works. I also contacted Vercel support, and their recommended workaround is to use unstable_allowDynamic.
@fpoirier1 could you provide the exact glob or string used with unstable_allowDynamic?
I used https://www.npmjs.com/package/@getkoala/js-bloom instead because it can run in middleware
I have same issue with error below