ghidalgo
ghidalgo

Reputation: 21

AWS XRay with AWS SDK v3 for NodeJS: typing issues

I'm moving my xray tracing for my aws-sdk from v2 to v3 and having some issues using the code provided from aws here: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-nodejs-awssdkclients.html

As well as some example code provided by a user here: AWS XRay with AWS SDK v3 for NodeJS

import { DynamoDBClient, ScanCommand } from '@aws-sdk/client-dynamodb';
import AWSXRay from 'aws-xray-sdk-core';

const dynamoClient = AWSXRay.captureAWSv3Client(new DynamoDBClient({}));

const scan = new ScanCommand({
  TableName: 'xxx',
});

const response = await dynamoClient.send(scan);

Regardless of the code use, I get a slurry of type issues starting with:

Argument of type 'DynamoDBClient' is not assignable to parameter of type 'Client<any, any, any>'.
     The types of 'middlewareStack.concat' are incompatible between these types...

This makes me think I'm missing some middleware types, but I can't find any documentation on this. Has anyone solved this issue?

Upvotes: 0

Views: 672

Answers (1)

ghidalgo
ghidalgo

Reputation: 21

Answer: was using an old version of the npm package aws-xray-sdk that came with the v2 aws-sdk, the following combination works for me:

"@aws-sdk/client-dynamodb": "3.398.0",
"aws-xray-sdk": "3.5.1",

Upvotes: 0

Related Questions