framesjs / frames.js

The fastest way to make Frames
https://framesjs.org
MIT License
341 stars 98 forks source link

Next.js App Router Error: Dynamic Code Evaluation not allowed in Edge Runtime #455

Open grantoesterling opened 1 month ago

grantoesterling commented 1 month ago

Running into the Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime error when adding the frame creation to generateMetadata in my Next14 app, as laid out in the docs here: https://framesjs.org/reference/core/next

Am I missing something or is this broken? :)

michalkvasnicak commented 1 month ago

@grantoesterling could you provide minimum reproducible code? We don't use WebAssembly directly so it must be an issue with some package. Since you provided only the error message it's hard to know where that happened.

davidfurlong commented 1 month ago

It sounds like some other part of your code isn't compatible with Vercel's edge runtime. You may want to try configuring it to use the Node.js runtime https://vercel.com/docs/functions/configuring-functions/runtime#node.js

grantoesterling commented 1 month ago

@michalkvasnicak sorry I should have included this, seems to be failing because of one of the framejs imports

../../node_modules/@protobufjs/inquire/index.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

Import trace for requested module:
../../node_modules/@protobufjs/inquire/index.js
../../node_modules/protobufjs/src/util/minimal.js
../../node_modules/protobufjs/src/index-minimal.js
../../node_modules/protobufjs/minimal.js
../../node_modules/frames.js/dist/chunk-MI43JRER.js
../../node_modules/frames.js/dist/next/index.js
./src/app/collections/[idOrSlug]/page.tsx

> Build failed because of webpack errors

@davidfurlong reasonably certain it isn't another part of my code as the error disappears when I comment the frame.js await fetchMetadata piece out of the generateMetadata section of that page. Tried adding that nodejs runtime to the framejs route but still getting the same error

Worth noting this is on Next 14.1.3 and frames.js version 0.17.4