Skip to content
New issue

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

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

Already on GitHub? # to your account

Type incompatibility in @smithy/types between XRay and DynamoDBClient #665

Closed
Jesusdiazrivero opened this issue Jul 8, 2024 · 1 comment

Comments

@Jesusdiazrivero
Copy link

Jesusdiazrivero commented Jul 8, 2024

Hello,

Error
It appears there is a type incompatibility between the XRay and AWS-SDK libraries.
The following boilerplate code returns an error:

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

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

There error is:
Argument of type 'DynamoDBClient' is not assignable to parameter of type 'Client<any, any, any>'.
Types of property 'middlewareStack' are incompatible.
Property 'identifyOnResolve' is missing in type 'MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>' but required in type 'MiddlewareStack<any, any>'.ts(2345)

Investigation
From what I've been able to assess, it seems the XRay library is using @smithy/types version ^3.3.0 (via @aws-sdk/types ^3.4.0) whereas the AWS SDK DynamoDB client library uses @smithy/types version ^1.1.0. The latter uses an additional generic parameter when declaring the Client class which seems to be the root cause of the issue.

I believe this issue is related to this one. I imagine there is a similar type incompatibility there. Not sure if this is a bug here and the version should be downgraded or if this should be raised to the AWS SDK team.

Package versions:

  • @aws-sdk/client-dynamodb: ^3.369.0
  • aws-xray-sdk-core: ^3.4.0
@Jesusdiazrivero
Copy link
Author

Nevermind, upgraded to 3.9.0 after seeing the type changes present there

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant