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

Capturing EventBridgeClient appears incompatible using import #4543

Closed
3 tasks done
camitz opened this issue Mar 17, 2023 · 5 comments
Closed
3 tasks done

Capturing EventBridgeClient appears incompatible using import #4543

camitz opened this issue Mar 17, 2023 · 5 comments
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.

Comments

@camitz
Copy link

camitz commented Mar 17, 2023

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

@camitz camitz added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 17, 2023
@camitz camitz changed the title TITLE FOR BUG REPORT Capturing EventBridgeClient appears incompatible using import Mar 17, 2023
@RanVaknin RanVaknin self-assigned this Mar 20, 2023
@RanVaknin RanVaknin added the p2 This is a standard priority issue label Mar 20, 2023
@RanVaknin
Copy link
Contributor

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,
Thanks,
Ran~

@RanVaknin RanVaknin added response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Mar 20, 2023
@camitz
Copy link
Author

camitz commented Mar 21, 2023

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?

@camitz camitz closed this as completed Mar 21, 2023
@camitz camitz reopened this Mar 21, 2023
@RanVaknin
Copy link
Contributor

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.
Once it releases, update your dependency and error hopefully should go away.

Since there's no actionable task from the JS SDK team I feel confident we can close this.
If you need anything else, please open another issue.

Thanks,
Ran~

@camitz
Copy link
Author

camitz commented Mar 21, 2023

Thanks Ran!

@github-actions
Copy link

github-actions bot commented Apr 5, 2023

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 5, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug This issue is a bug. p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days.
Projects
None yet
Development

No branches or pull requests

2 participants