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

[Bug?]: Still using aws-sdk and incorrect endpoint #484

Closed
1 task
sheldonmaschmeyer opened this issue Apr 14, 2023 · 6 comments
Closed
1 task

[Bug?]: Still using aws-sdk and incorrect endpoint #484

sheldonmaschmeyer opened this issue Apr 14, 2023 · 6 comments
Labels
bug Something isn't working p2 This is a standard priority issue

Comments

@sheldonmaschmeyer
Copy link

Self-service

  • I'd be willing to implement a fix

Template name

v2-to-v3

Describe the bug

The cmd npx aws-sdk-ts-codemod -t v2-to-v3 myfile.ts transforms all but a few related lines of code correctly as shown below

Input code

import aws from 'aws-sdk'; // Still Version 2

aws.config.credentials = options; // using version 2

const kinesisVideoArchivedMedia = new KinesisVideoArchivedMedia({
    endpoint: new aws.Endpoint(endpoint), // version mismatch
    region: process.env.AWS_REGION as string,
  });

Observed failure

The credentials seem to be configured using version 2. Creates a version 2 endpoint and tries to use in version 3 of kinesisVideoArchivedMedia.

The rest of the code seems to have converted properly.

const kinesisVideoArchivedMedia = new KinesisVideoArchivedMedia({
    endpoint: new aws.Endpoint(endpoint),
    region: process.env.AWS_REGION as string,
});
Type 'Endpoint' is not assignable to type '((string | Endpoint | Provider<Endpoint> | EndpointV2 | Provider<EndpointV2>) & (string | Provider<string> | Endpoint | Provider<...> | EndpointV2 | Provider<...>)) | undefined'.
  Type 'Endpoint' is not assignable to type 'Provider<EndpointV2> & Endpoint'.
    Type 'Endpoint' is not assignable to type 'Provider<EndpointV2>'.
      Type 'Endpoint' provides no match for the signature '(): Promise<EndpointV2>'.ts(2322)

Runtime error:

/home/app/.yarn/cache/@aws-sdk-client-kinesis-video-npm-3.312.0-ab34e328a1-47c7fc40ef.zip/node_modules/@aws-sdk/client-kinesis-video/dist-cjs/protocols/Aws_restJson1.js:14
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/createSignalingChannel";
SyntaxError: Unexpected token '.'

Expected output

No TypeScript errors and no runtime errors after conversion.
Before conversion, there are no errors.

Environment

aws-sdk-js-codemod: 0.14.1
- jscodeshift: 0.14.0
- recast: 0.21.5

Additional context

No response

@sheldonmaschmeyer sheldonmaschmeyer added bug Something isn't working triage Triaging bugs labels Apr 14, 2023
@trivikr
Copy link
Member

trivikr commented Apr 14, 2023

For future reference, this is a feature request for transformation for Endpoint from global import

@sheldonmaschmeyer
Copy link
Author

I had manually migrated the code (weeks ago) but, since this is regarding an automatic tool, I will keep the PR open.

@trivikr trivikr added p2 This is a standard priority issue and removed triage Triaging bugs labels Jul 25, 2023
@trivikr
Copy link
Member

trivikr commented Aug 1, 2023

import aws from 'aws-sdk'; // Still Version 2

aws.config.credentials = options; // using version 2

This is an extension of request for AWS.Config transformation in #36

@trivikr
Copy link
Member

trivikr commented Aug 1, 2023

This is an extension of request for AWS.Config transformation in #36

Here is what we plan to do:

@trivikr
Copy link
Member

trivikr commented Nov 13, 2023

Only remaining ask is AWS.Endpoint which is being tracked in #694

@trivikr trivikr closed this as completed Nov 13, 2023
Copy link
Contributor

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 Nov 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants