Skip to content

kanadgupta/nock-beta-stripe-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

issue with stripe and nock@beta

this repository demostrates an issue (nock/nock#2785, stripe/stripe-node#2211) where API requests from the stripe SDK aren't being intercepted by nock@beta, nor its underlying interceptor library (@mswjs/interceptors).

reproduction steps

with node.js installed (this was tested on v20.16.0), run the following commands:

npm install
node nock.js # nock@beta
node msw.js # @mswjs/interceptors

note how the stripe.customers.create function in request.js hangs.

if you install nock@14.0.0-beta.7 or nock@latest, the stripe SDK will successfully make the request:

npm install nock@14.0.0-beta.7
node nock.js

workaround

configure the stripe SDK to use fetch by making the following change in request.js:

-const stripe = new Stripe("your-stripe-secret-key");
+const stripe = new Stripe("your-stripe-secret-key", { httpClient: Stripe.createFetchHttpClient() });

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published