aws / aws/aws-sdk-js-codemod

[Bug]: Cloudfront Signer is not replaced

Open
#736 0 comments 2 reactions 0 assignees View on GitHub
bug p2
Dominant language
TypeScript
Stars
89
Forks
13
Avg merge
9h 59m
Merged PRs (30d)
1

Description

### Self-service

- [ ] I'd be willing to implement a fix

### Describe the bug

Running transform containing a Cloudfront Signer does not transform, but only remove the legacy import

### Steps to reproduce

```ts
import { CloudFront } from "aws-sdk";
//....
export async function cloudfrontSignUrl(url, expires_at_ms, options = {}) {
// ...
let signer = new CloudFront.Signer(accessKeyID, privateKeyContents);
return signer.getSignedUrl({ url, expires: expires_at_ms, ...options });
}
```

### Observed behavior

* Removes `import { CloudFront } from "aws-sdk";`

### Expected behavior

Should result in

```ts
import { getSignedUrl } from "@aws-sdk/cloudfront-signer";
// ...
export async function cloudfrontSignUrl(url, expires_at_ms, options = {}) {
// ...
return getSignedUrl({ url, privateKey: privateKeyContents, keyPairId: accessKeyID, dateLessThan: expires_at_ms})
}
```

### Environment

```shell
aws-sdk-js-codemod: 0.28.2
- jscodeshift: 0.15.0
- recast: 0.23.4
```

### Additional context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by locating the codemod transform that handles CloudFront.Signer and the existing tests or fixtures for AWS SDK migrations. Reproduce the example, then add coverage showing that the legacy import and signer call become the @aws-sdk/cloudfront-signer import and getSignedUrl usage described in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.