Skip to content

Commit

Permalink
added readme about outgoingPatch option. (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
xinghengwang authored Aug 8, 2024
1 parent bb1d7b0 commit 8d44f17
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,33 @@ As an example, many Koa auth middleware save the authenticated user on `ctx.stat
- [View example app with Next.js](https://github.com/Moesif/moesif-next-js-example)
- [View example app with Fastify](https://github.com/Moesif/fastify-moesif-nodejs-example)

## Trouble shooting capturing outgoing APIs:

For instrumenting/capturing outgoing api calls, it instruments standard HTTP or HTTPs from node core,
however, some third party SDKS may use customized http clients to make API calls thus interferes with instrumentation. Few things to try:

- Some SDKS, like the Stripe node SDK, even though they have a very customized http client, it let you swap out to a more standard http client like `node-fetch`.

```javascript
import fetch from 'node-fetch'; // you may have to add by `npm install node-fetch` or yarn equivalent.
import Stripe from 'stripe';

const stripeClient = Stripe('your secret key', {
// basically you are using node fetch as the httpClient.
httpClient: Stripe.createFetchHttpClient(fetch),
});
```

- Turn `outgoingPatch` flag to `true` in options to make an attempt to cover non standard http client usage, but it may not cover all cases.

```javascript
{
const moesifOptions = {
// ... other options,
outgoingPatch: true
};
```
## Other integrations
To view more documentation on integration options, please visit __[the Integration Options Documentation](https://www.moesif.com/docs/getting-started/integration-options/).__
Expand Down

0 comments on commit 8d44f17

Please sign in to comment.