Stripe JS SDK & next-on-pages Compatibility

Hi all - is it known if the Stripe SDK is compatible with next-on-pages? I have a NextJS app that I'd like to deploy on pages, and am using next-on-pages to support SSR & bundling my /pages/api/*.ts API's into workers, however, my pages builds are failing with:
22:53:11.754 ▲ Failed to compile.
22:53:11.755 ▲ ../../node_modules/function-bind/implementation.js
22:53:11.755 ▲ Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
22:53:11.755 ▲ Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation
22:53:11.755 ▲
22:53:11.755 ▲ Import trace for requested module:
22:53:11.755 ▲ ../../node_modules/function-bind/implementation.js
22:53:11.755 ▲ ../../node_modules/function-bind/index.js
22:53:11.756 ▲ ../../node_modules/get-intrinsic/index.js
22:53:11.756 ▲ ../../node_modules/side-channel/index.js
22:53:11.756 ▲ ../../node_modules/stripe/node_modules/qs/lib/stringify.js
22:53:11.756 ▲ ../../node_modules/stripe/node_modules/qs/lib/index.js
22:53:11.756 ▲ ../../node_modules/stripe/esm/utils.js
22:53:11.756 ▲ ../../node_modules/stripe/esm/stripe.core.js
22:53:11.756 ▲ ../../node_modules/stripe/esm/stripe.esm.worker.js
22:53:11.756 ▲ ./lib/stripe.ts
22:53:11.754 ▲ Failed to compile.
22:53:11.755 ▲ ../../node_modules/function-bind/implementation.js
22:53:11.755 ▲ Dynamic Code Evaluation (e. g. 'eval', 'new Function', 'WebAssembly.compile') not allowed in Edge Runtime
22:53:11.755 ▲ Learn More: https://nextjs.org/docs/messages/edge-dynamic-code-evaluation
22:53:11.755 ▲
22:53:11.755 ▲ Import trace for requested module:
22:53:11.755 ▲ ../../node_modules/function-bind/implementation.js
22:53:11.755 ▲ ../../node_modules/function-bind/index.js
22:53:11.756 ▲ ../../node_modules/get-intrinsic/index.js
22:53:11.756 ▲ ../../node_modules/side-channel/index.js
22:53:11.756 ▲ ../../node_modules/stripe/node_modules/qs/lib/stringify.js
22:53:11.756 ▲ ../../node_modules/stripe/node_modules/qs/lib/index.js
22:53:11.756 ▲ ../../node_modules/stripe/esm/utils.js
22:53:11.756 ▲ ../../node_modules/stripe/esm/stripe.core.js
22:53:11.756 ▲ ../../node_modules/stripe/esm/stripe.esm.worker.js
22:53:11.756 ▲ ./lib/stripe.ts
./lib/stripe.ts is essentially:
import Stripe from "stripe";

export const stripe = new Stripe(
process.env.STRIPE_SECRET_KEY ?? "",
{
apiVersion: "2022-11-15",
httpClient: Stripe.createFetchHttpClient(), // ensure we use a Fetch client, and not Node's `http`
}
);
import Stripe from "stripe";

export const stripe = new Stripe(
process.env.STRIPE_SECRET_KEY ?? "",
{
apiVersion: "2022-11-15",
httpClient: Stripe.createFetchHttpClient(), // ensure we use a Fetch client, and not Node's `http`
}
);
My stripe version is 12.6.0 While I know there is support for Stripe JS SDK in workers, would love to know if next-on-pages supports Stripe. Thanks!
1 Reply
RexNormous
RexNormous13mo ago
Continuing the discussion on Github issues: https://github.com/cloudflare/next-on-pages/issues/286
GitHub
[🐛 Bug]: Importing Stripe fails next-on-pages builds · Issue #286 ·...
next-on-pages environment related information System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 22.1.0: Sun Oct 9 20:15:09 PDT 2022; root:xnu-8792.41.9~2/RELEASE_ARM64_T6000 CPU: ...