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

X-Ray captureAWSClient DynamoDB DocumentClient didn't work #1846

Closed
polovi opened this issue Dec 27, 2017 · 6 comments
Closed

X-Ray captureAWSClient DynamoDB DocumentClient didn't work #1846

polovi opened this issue Dec 27, 2017 · 6 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.

Comments

@polovi
Copy link

polovi commented Dec 27, 2017

Is there some workaround for capture DocumentClient with xray except capture whole SDK?
Due to creating custom service provider this code didnt work.

const AWSXray = require('aws-xray-sdk')
const AWS = require('aws-sdk')
 
const client = new AWS.DynamoDB.DocumentClient({
  service: AWSXray.captureAWSClient(new AWS.DynamoDB({...}))
})

If service from configuration will be used as it is and not created again then captureAWSClient will be work. I also set everything up in my service and no configuration params ar pushed to DocumentClient constructor

@chrisradek
Copy link
Contributor

@polovi
A possible workaround would be to wrap the service client after you've created the DocumentClient.

const AWSXray = require('aws-xray-sdk');
const AWS = require('aws-sdk');

const client = new AWS.DynamoDB.DocumentClient({
  service: new AWS.DynamoDB({...})
});

AWSXray.captureAWSClient(client.service);

@polovi
Copy link
Author

polovi commented Dec 28, 2017

@chrisradek
Seems that AWSXray.captureAWSClient(client.service) works as workaround

But there is problem if i use typescript that AWS.DynamoDB.DocumentClient.service is internal and not defined in d.ts file so I am not able to compile it

@leonardovillela
Copy link

Any progress?

@Tehnix
Copy link

Tehnix commented Oct 29, 2018

@polovi a workaround for your TypeScript issue is,

...
AWSXray.captureAWSClient((client as any).service);

which casts the client to any, just so you can access service on it.

@srchase srchase added guidance Question that needs advice or information. closing-soon This issue will automatically close in 4 days unless further comments are made. and removed Question labels Dec 27, 2018
@no-response
Copy link

no-response bot commented Jan 3, 2019

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Jan 3, 2019
@lock
Copy link

lock bot commented Sep 29, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made. guidance Question that needs advice or information.
Projects
None yet
Development

No branches or pull requests

5 participants