-
Notifications
You must be signed in to change notification settings - Fork 583
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
Capturing EventBridgeClient appears incompatible using import #4543
Comments
Hi @camitz, I'm not entirely sure why this is happening. I see the TS linter come up with the same error but I am able to successfully compile this into a js file and run it: index.ts: import * as AWSXRay from "aws-xray-sdk-core";
import { EventBridgeClient, ListEndpointsCommand } from '@aws-sdk/client-eventbridge'
const ebclient = new EventBridgeClient({ region: "us-east-1" })
const client = AWSXRay.captureAWSv3Client(ebclient);
async function run(){
try {
const res = await client.send(new ListEndpointsCommand({}))
console.log(res)
} catch (error) {
console.log(error)
}
}
run() $ tsc index.ts
$ node index.js
{
'$metadata': {
httpStatusCode: 200,
requestId: 'REDACTED',
extendedRequestId: undefined,
cfId: undefined,
attempts: 1,
totalRetryDelay: 0
},
Endpoints: [
{
Arn: 'arn:aws:events:us-east-1:REDACTED:endpoint/REDACTED',
CreationTime: 2022-06-16T19:14:20.103Z,
Description: '',
EndpointId: 'REDACTED',
EndpointUrl: 'REDACTED',
EventBuses: [Array],
LastModifiedTime: 2022-06-16T19:14:21.691Z,
Name: 'REDACTED',
ReplicationConfig: [Object],
RoleArn: 'arn:aws:iam::REDACTED:role/service-role/Amazon_EventBridge_Invoke_Event_Bus_REDACTED',
RoutingConfig: [Object],
State: 'ACTIVE',
StateReason: undefined
}
],
NextToken: undefined
} Let me know if this helps, |
Reproducing your sample sufficiently, @RanVaknin, although with sdk 3.295.0 and not 3.142.0. I did not expect it to run on lambda although that too worked. That was my real issue previously so somehow that was resolved in the process. The linter squigglies are annoying though. Any ideas? |
Hi @camitz, It seems like the Xray team have fixed this issue with this PR, but there hasn't been a release to the Xray SDK with those changes. Since there's no actionable task from the JS SDK team I feel confident we can close this. Thanks, |
Thanks Ran! |
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. |
Checkboxes for prior research
Describe the bug
In reference to issue #3316 EventBridgeClient incompatible with Xray SDK:
This works as @yenfryherrerafeliz suggested:
const xray = require("aws-xray-sdk-core");
This however, does not.
import * as xray from "aws-xray-sdk-core";
SDK version number
@aws-sdk/[email protected]
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
v18.11.0
Reproduction Steps
import * as xray from "aws-xray-sdk-core";
import { EventBridgeClient } from "@aws-sdk/client-eventbridge";
const eventBridgeClient = new EventBridgeClient({ region: 'us-east-2' });
xray.captureAWSv3Client(eventBridgeClient);
Observed Behavior
Argument of type 'EventBridgeClient' is not assignable to parameter of type 'Client<any, any, any>'.
Expected Behavior
No error.
Possible Solution
Default exports.
Additional Information/Context
No response
The text was updated successfully, but these errors were encountered: