Skip to content

refactor(aws-toolkit-vscode): migrate aws-sdk v2 to v3#8183

Merged
chungjac merged 54 commits intomasterfrom
feature/v2-to-v3-migration
Oct 21, 2025
Merged

refactor(aws-toolkit-vscode): migrate aws-sdk v2 to v3#8183
chungjac merged 54 commits intomasterfrom
feature/v2-to-v3-migration

Conversation

@chungjac
Copy link
Contributor

Note

There is still a little bit more work needed for fully migrating aws-sdk v2 to v3, specifically all of these clients here from the generateServiceClient.ts script

Problem

AWS SDK V2 is at EOL

Solution

Migrate AWS SDK V2 to V3

This work has been done in the feature/v2-to-v3-migration feature branch and thus merging it into master

Here are the PRs, which this does not include the merges from main and resolving conflicts:

Testing

Manually tested the prerelease builds

Screen.Recording.2025-10-15.at.1.19.16.PM.mov

  • Treat all work as PUBLIC. Private feature/x branches will not be squash-merged at release time.
  • Your code changes must meet the guidelines in CONTRIBUTING.md.
  • License: I confirm that my contribution is made under the terms of the Apache 2.0 license.

## Problem

AWS SDK V2 is at EOL. All client should migrate to V3.


## Solution

Migrate CodeCatalyst client to V3.


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL. All clients should migrate to V3.


## Solution

Migrate API Gateway client to V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL. All client should migrate to V3.


## Solution

Migrate accessanalyzer client to V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL. All clients should migrate to V3.


## Solution

Migrate IoT client to AWS SDK V3.


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK v2 is at EOL. All clients should migrate to V3


## Solution

Migrate Lambda client to AWS SDK V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL. 

## Solution

Migrate Schemas client to V3

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is EOL.

## Solution

Migrate IoT imports to V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL.

## Solution

Migrate Redshift client to V3

---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Co-authored-by: invictus <149003065+ashishrp-aws@users.noreply.github.com>
## Problem

AWS SDK V2 is at EOL.


## Solution

Migrate SSM client to V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL


## Solution

Migrate Schemas to V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL.


## Solution

Migrate SecretsManager client to V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem

AWS SDK V2 is at EOL.


## Solution

Migrate ECS client to V3


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
## Problem
The `AppBuilder Walkthrough` test was previously skipped because it is
flaky and would some friction when merging in PRs to the
`feature/v2-to-v3-migration` branch

## Solution
Unskip the `AppBuilder Walkthrough` test as we prepare to merge the
`feature/v2-to-v3-migration` branch into `main`


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.
@chungjac chungjac requested a review from a team as a code owner October 15, 2025 20:22
@amazon-inspector-ohio
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@amazon-inspector-ohio
Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

@chungjac chungjac closed this Oct 15, 2025
@chungjac chungjac reopened this Oct 15, 2025
@amazon-inspector-ohio
Copy link

⏳ I'm reviewing this pull request for security vulnerabilities and code quality issues. I'll provide an update when I'm done

@amazon-inspector-ohio
Copy link

✅ I finished the code review, and didn't find any security or code quality issues.

@chungjac
Copy link
Contributor Author

Linux Unit Tests - insiders is known flaky

Class Test Case Status
download serverlessland proj AppBuilder Walkthrough Create project start with an existing template override existing template download serverlessland proj FAILED
Error: Test length exceeded max duration: 30 seconds [No Pending UI Elements Found]     at Timeout._onTimeout (/codebuild/output/src3602161298/src/github.com/aws/aws-toolkit-vscode/packages/core/src/test/setupUtil.ts:47:32)     at listOnTimeout (node:internal/timers:588:17)     at processTimers (node:internal/timers:523:7)

@chungjac
Copy link
Contributor Author

chungjac commented Oct 15, 2025

The E2E and integration tests seem to be running on this PR because the test files were changed:

  • packages/core/src/testE2E/codecatalyst/client.test.ts
  • packages/core/src/testInteg/sam.test.ts

Based on the latest commits to master branch: https://github.com/aws/aws-toolkit-vscode/commits/master/, the same E2E and integration tests are also failing. Here are some examples from existing master branch:

Class Test Case Status
3: contains correct resource node properties Application Builder application nodes in workspace (Test in order) 3: contains correct resource node properties FAILED
"before all" hook in "SAM Integration Tests" SAM Integration Tests "before all" hook in "SAM Integration Tests" FAILED
Class Test Case Status
"before all" hook for "produces an Add Debug Configuration codelens" SAM Integration Tests SAM runtime: nodejs18.x (Image) Starting with a newly created nodejs18.x (Image) SAM Application... "before all" hook for "produces an Add Debug Configuration codelens" FAILED
"before all" hook for "produces an Add Debug Configuration codelens" SAM Integration Tests SAM runtime: nodejs18.x (ZIP) Starting with a newly created nodejs18.x (ZIP) SAM Application... "before all" hook for "produces an Add Debug Configuration codelens" FAILED
3: contains correct resource node properties Application Builder application nodes in workspace (Test in order) 3: contains correct resource node properties
Screenshot 2025-10-15 at 2 33 15 PM

Copy link
Contributor

@rli rli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's up with the failures?

@chungjac
Copy link
Contributor Author

what's up with the failures?

To my knowledge, the E2E/Integration tests have always failed. They will run after every commit into main. By default, they are not run before a PR is merges, but can be if a user comments /runIntegrationTests on the PR.

Based on the CI on the latest commit to main, all E2E/Integration tests are still failing. Even when browsing through all the commits to main in August for example, all E2E/Integration still failed.

At this point, I'm not sure if anyone even checks them or we can reliably trust the results of them without a further deep dive.

@chungjac
Copy link
Contributor Author

In regards to why the E2E/Integration tests are running on this PR, it looks like they are also automatically run if the test files were edited. In this case, I migrated these files:

  • packages/core/src/testE2E/codecatalyst/client.test.ts
  • packages/core/src/testInteg/sam.test.ts

@chungjac
Copy link
Contributor Author

/retryBuilds

@chungjac chungjac merged commit d34ddfe into master Oct 21, 2025
48 of 54 checks passed
laileni-aws added a commit that referenced this pull request Nov 19, 2025
## Problem
The AWS SDK v2 to v3 migration in PR #8183 introduced breaking changes
for LocalStack compatibility and Lambda debugging is not working
anymore:

1. **User Agent format changed:** The migration changed from
string-based user agents to AWS SDK v3's `UserAgent` pairs format
(`[name, version]` tuples), but several places still used the old string
format, breaking LocalStack's custom user agent for Lambda debugging and
part of the integration with IoT
2. **Response headers no longer accessible**: AWS SDK v3 removed access
to HTTP response headers via `$response.httpResponse.headers`, breaking
LocalStack connection detection which relies on the
`x-localstack-request-url` header

These issues were not caught most likely because LocalStack
compatibility was not tested during the SDK v3 migration.

## Solution
1. Fix user agent format for AWS SDK v3
* Migrated from string-based user agents to proper UserAgent pairs
format:
     
     * Changed from "LAMBDA-DEBUG/1.0.0 AWS-Toolkit/..." (string)
* To [['LAMBDA-DEBUG', '1.0.0'], ['AWS-Toolkit', '2.0'], ...] (pairs)
* Updated awsClientBuilderV3 to use customUserAgent instead of userAgent


2. Add response headers middleware for AWS SDK v3 
* Added `captureHeadersMiddleware` to `AWSClientBuilderV3` that attaches
HTTP response headers to the output via `$httpHeaders` property
* Updated `loginManager` to check for LocalStack connection using
`$httpHeaders` instead of the removed `$response.httpResponse.headers`

## AWS SDK v3 Breaking Changes
### User Agent Format
**SDK v2**:

```ts
// String format in client options
const options = {
    region: 'us-east-1',
    userAgent: 'LAMBDA-DEBUG/1.0.0 AWS-Toolkit/2.0.0'
}
```

**SDK v3:**

```ts
// Array of [name, version] tuples
const options = {
    region: 'us-east-1',
    customUserAgent: [
        ['LAMBDA-DEBUG', '1.0.0'],
        ['AWS-Toolkit', '2.0.0']
    ]
}
```

### Response Headers Access
**SDK v2**:

```ts
const response = await client.send(command)
// Headers directly accessible
const headers = response.$response.httpResponse.headers
const localStackUrl = headers['x-localstack-request-url']
```

**SDK v3**:

```ts
const response = await client.send(command)
// Headers NOT accessible by default - requires custom middleware
const headers = response.$httpHeaders  // undefined without middleware
```

Supersedes #8289 and #8291


---

- Treat all work as PUBLIC. Private `feature/x` branches will not be
squash-merged at release time.
- Your code changes must meet the guidelines in
[CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines).
- License: I confirm that my contribution is made under the terms of the
Apache 2.0 license.

---------

Co-authored-by: carole-lavillonniere <carole.lavillonniere@gmail.com>
Co-authored-by: Cristian Pallarés <cristian.pallares@localstack.cloud>
Co-authored-by: Laxman Reddy <141967714+laileni-aws@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants