Skip to content

Conversation

@svidgen
Copy link
Member

@svidgen svidgen commented Sep 29, 2025

Description of changes

Migrates amplify-e2e-tests and amplify-e2e-core packages from AWS SDK v2 to v3, resolving compatibility issues in
the e2e test infrastructure.

CDK / CloudFormation Parameters Changed

Issue #, if available

Description of how you validated changes

PR Checks
E2E Tests

Checklist

  • PR description included
  • yarn test passes
  • E2E test run linked
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)
  • New AWS SDK calls or CloudFormation actions have been added to relevant test and service IAM policies
  • Any CDK or CloudFormation parameter changes are called out explicitly

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

- Update package.json dependencies from aws-sdk v2 to v3 clients
- Migrate all AWS service imports and usage patterns:
  - S3Client, IAMClient, CognitoIdentityProviderClient
  - CloudFormationClient, STSClient, OrganizationsClient
  - CodeBuildClient, AmplifyClient
- Update method calls (remove .promise(), use send() with commands)
- Fix type definitions for OAuth flows and other Cognito types
- Create compatibility layer for deleteS3Bucket function
- Update imports in 7 files with AWS SDK usage
- All TypeScript compilation successful

Files updated:
- src/cleanup-e2e-resources.ts (major refactor)
- src/cleanup-stale-test-buckets.ts
- src/schema-api-directives/authHelper.ts
- src/import-helpers/utilities.ts
- src/import-helpers/types.ts
- src/aws-matchers/s3matcher.ts
- src/aws-matchers/iamMatcher.ts
…sons

- Fix type mismatch in DynamoDBModelTransformer, KeyTransformer, and ModelConnectionTransformer
- Convert getTransformerVersion() result to Number for comparison with CONDITIONS_MINIMUM_VERSION
- Pin amplify-e2e-tests AWS SDK versions to ~3.600.0
- Avoids Jest compatibility issues with node: prefixed imports
- Maintains AWS SDK v3 benefits while ensuring test compatibility
- TODO: Upgrade to latest versions after Jest config updates
…tion

- Fix AWSAccountInfo type to use fromTemporaryCredentials
- Replace manual STS assume role with fromTemporaryCredentials
- Update all AWS client instantiations to use simplified credentials
- Fix S3 bucket deletion to use v2 client for e2e-core compatibility
- Remove broken getAWSConfig function

This addresses the cleanup_e2e_resources build failures by reverting
to the working credential approach from main branch while maintaining
compatibility with current e2e-core package.
- Migrate deleteS3Bucket function in e2e-core to use AWS SDK v3 S3Client
- Add @aws-sdk/client-s3 dependency to e2e-core package
- Remove aws-sdk v2 import from cleanup script
- Update cleanup script to use v3 S3Client directly with deleteS3Bucket
- Fix type compatibility issues between S3Client versions

This completes the migration by ensuring every file in amplify-e2e-tests
package uses AWS SDK v3 fully, with no v2 dependencies remaining.
- Migrate cleanup-stale-test-buckets.ts to use v3 S3Client with deleteS3Bucket
- Migrate auth-migration.test.ts to use v3 IAMClient
- Migrate custom_policies_container.test.ts to use v3 SSMClient with send() pattern
- Migrate predictions-usage.ts to use v3 S3Client with PutObjectCommand
- Add missing @aws-sdk/client-ssm dependency
- Fix ACL type compatibility for PutObjectCommand

All files in amplify-e2e-tests package now use AWS SDK v3 exclusively.
No aws-sdk v2 imports remain in the package.
…s-usage.ts

- Remove duplicate imports and function declarations that were causing TypeScript compilation errors
- Keep the corrected version with regionalized S3Client and GetBucketLocationCommand import
- Remove ACL parameter from S3 upload in predictions-usage.ts to fix
  AccessControlListNotSupported error
- Fix DynamoDB error message format in getDDBTable to ensure message
  property is enumerable for Object.assign in tests
- Change e?.code to e?.name for UnrecognizedClientException and InvalidClientTokenId
- Update console.log messages to use e?.name instead of e?.code
- Fixes cleanup_e2e_resources failures due to incorrect error property access
…anup

- change e.code to e.name for AWS SDK v3 compatibility
- fixes NoSuchTagSet error in cleanup process
- updates all error handling patterns in cleanup script
- add @aws-sdk/util-dynamodb dependency
- use marshall() to convert plain objects to DynamoDB attribute format
- fixes TypeError in putItemInTable function for AWS SDK v3 compatibility
- use transformToString() method for S3 GetObjectCommand response body
- fixes stream reading compatibility issue in schema-iterative-update-locking test
- resolves retry-able function predicate constraint error
@svidgen
Copy link
Member Author

svidgen commented Oct 2, 2025

✅ Tests : https://tiny.amazon.com/cc6fy5ds/IsenLink
✅ Check : https://tiny.amazon.com/1hwe2go4o/IsenLink
❌ Tests finally passing only to find my destination branch has drifted. 🤦

@svidgen
Copy link
Member Author

svidgen commented Oct 2, 2025

PR Checks
E2E Tests

@svidgen svidgen marked this pull request as ready for review October 3, 2025 14:17
@svidgen svidgen requested review from a team as code owners October 3, 2025 14:17
compute-type: BUILD_GENERAL1_MEDIUM
variables:
JSII_DEPRECATED: 'quiet'
JSII_DEPRECATED: quiet
Copy link
Member Author

Choose a reason for hiding this comment

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

Unclear to me whether this is intrinsic to the upgrade. Q did this while troubleshooting e2e failures, and I'm inclined to keep the change unless it's proven wrong.

- replace CodeBuild and CloudWatchLogs with v3 clients
- update SharedIniFileCredentials to fromIni credential provider
- remove .promise() calls and use command pattern
- add required @AWS-SDK dependencies to scripts package.json
@svidgen svidgen requested a review from ShadowCat567 October 3, 2025 14:51
Copy link
Contributor

@ShadowCat567 ShadowCat567 left a comment

Choose a reason for hiding this comment

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

Only one of these comments is something actionable and it is optional whether you want to pursue it since the current implementation works fine

@svidgen svidgen merged commit f05c3a8 into release-api-plugin-stable Oct 3, 2025
6 of 7 checks passed
@svidgen svidgen deleted the wirej/aws-sdk-v3-amplify-e2e-tests branch October 3, 2025 15:36
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.

2 participants