Next.js Discord

Discord Forum

stripe edge causing error in next build

Unanswered
English Shepherd posted this in #help-forum
Open in Discord
English ShepherdOP
during next dev, it works well for edge configuration but next build gives the following error. any idea why ?

../../node_modules/function-bind/implementation.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/function-bind/implementation.js
../../node_modules/function-bind/index.js
../../node_modules/get-intrinsic/index.js
../../node_modules/side-channel/index.js
../../node_modules/qs/lib/stringify.js
../../node_modules/qs/lib/index.js
../../node_modules/stripe/esm/utils.js
../../node_modules/stripe/esm/stripe.core.js
../../node_modules/stripe/esm/stripe.esm.worker.js
./src/core/clients/stripe.ts

4 Replies

English ShepherdOP
it seems the place where it complains is the stringify of qs lib.
/**
 * Stringifies an Object, accommodating nested objects
 * (forming the conventional key 'parent[child]=value')
 */
export function stringifyRequestData(data) {
    return (qs
        .stringify(data, {
        serializeDate: (d) => Math.floor(d.getTime() / 1000).toString(),
    })
        // Don't use strict form encoding by changing the square bracket control
        // characters back to their literals. This is fine by the server, and
        // makes these parameter strings easier to read.
        .replace(/%5B/g, '[')
        .replace(/%5D/g, ']'));
}
, not sure why it doesn't complain during test but appears in next build
WebAssembly doesn’t work in Edge Runtime, which supports subset of Node.js
Barbary Lion
this error is so annoying, is there any way to disable it globally?
you mean C codes?