RexNormous
RexNormous
CDCloudflare Developers
Created by RexNormous on 5/25/2023 in #pages-help
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!
2 replies