Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include workaround for possible AWS SDK v3 type error #442

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 24 additions & 4 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ var AWS = captureAWS(require('aws-sdk'));
### Capture outgoing AWS requests on a single client


AWS SDK v3
**AWS SDK v3**

```js
import { S3, PutObjectCommand } from '@aws-sdk/client-s3';
Expand All @@ -490,7 +490,17 @@ await s3.send(new PutObjectCommand({
}));
```

AWS SDK v2
Note: Some TypeScript users may experience a type incompatibility error when patching v3 clients. As a workaround, you can cast the client
to type `any` when patching:

```js
import { S3, PutObjectCommand } from '@aws-sdk/client-s3';

const s3 = new S3({});
const s3Patched = AWSXRay.captureAWSv3Client(s3 as any);
```

**AWS SDK v2**

```js
var s3 = AWSXRay.captureAWSClient(new AWS.S3());
Expand Down Expand Up @@ -642,7 +652,7 @@ function sendRequest(host, cb, subsegment) {

### Capture outgoing AWS requests on a single client

AWS SDK v3
**AWS SDK v3**

You must re-capture the client every time the subsegment is attached to a new parent.

Expand All @@ -660,7 +670,17 @@ await s3.send(new PutObjectCommand({
}));
```

AWS SDK v2
Note: Some TypeScript users may experience a type incompatibility error when patching v3 clients. As a workaround, you can cast the client
to type `any` when patching:

```js
import { S3, PutObjectCommand } from '@aws-sdk/client-s3';

const s3 = new S3({});
const s3Patched = AWSXRay.captureAWSv3Client(s3 as any);
```

**AWS SDK v2**

```js
var s3 = AWSXRay.captureAWSClient(new AWS.S3());
Expand Down