Next.js Discord

Discord Forum

Dynamic code evaluation error with Sequelize

Unanswered
MichaelVanhoutte posted this in #help-forum
Open in Discord
I'm currently setting up serveral api routes that use sequelize to acces my postgres database. I can confirm that my connection works but when i try to add a middleware that uses one of my sequelize models, then i get the below error output when i try to build the project. I've already found this in the next documentation https://nextjs.org/docs/messages/edge-dynamic-code-evaluation but don't know how to implement the config for example, since unstable_allowDynamic is not something you use in the next.config. Sadly it doesn't say where i should put it and the first way to fix it is not applicable to my case i believe. I've already tried adding this to my next.config const nextConfig = { experimental: { serverComponentsExternalPackages: ['sequelize'], }, }

Failed to compile. ./node_modules/lodash/_root.js Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime Import trace for requested module: ./node_modules/lodash/_root.js ./node_modules/lodash/_coreJsData.js ./node_modules/lodash/_isMasked.js ./node_modules/lodash/_baseIsNative.js ./node_modules/sequelize/lib/utils.js ./node_modules/sequelize/lib/sequelize.js ./node_modules/sequelize/lib/index.js ./node_modules/sequelize/lib/index.mjs ./src/db/models/index.js ./node_modules/lodash/lodash.js Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime > Build failed because of webpack errors

0 Replies