0

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?

ghidalgo
  • 1
  • 1
  • *According to the AWS docs I've also used the module `aws-xray-sdk` (without the -core suffix) which gives the same error – ghidalgo Aug 29 '23 at 16:05
  • See if this helps: https://stackoverflow.com/questions/72485887/aws-xray-with-aws-sdk-v3-for-nodejs though perhaps that is where you got your code from in the first place. – jarmod Aug 29 '23 at 16:20

1 Answers1

0

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",
ghidalgo
  • 1
  • 1