Skip to content

fix(cli): handle unsupported S3 acceleration in migration#14900

Open
hariharan077 wants to merge 1 commit into
aws-amplify:devfrom
hariharan077:fix-14876-s3-accelerate-method-not-allowed
Open

fix(cli): handle unsupported S3 acceleration in migration#14900
hariharan077 wants to merge 1 commit into
aws-amplify:devfrom
hariharan077:fix-14876-s3-accelerate-method-not-allowed

Conversation

@hariharan077
Copy link
Copy Markdown

Description of changes

Fixes #14876.

amplify gen2-migration generate currently fails when S3 returns MethodNotAllowed for GetBucketAccelerateConfiguration, which can happen for buckets in regions where transfer acceleration is unsupported. This updates AwsFetcher.fetchBucketAccelerate() to treat only MethodNotAllowed as an unavailable/disabled acceleration state and return undefined, while still propagating other S3 errors.

Also adds focused coverage for:

  • returning the bucket acceleration status when available
  • returning undefined for MethodNotAllowed
  • propagating non-MethodNotAllowed failures

Description of how you validated changes

  • Reproduced the issue locally with the new regression test against the original implementation: the MethodNotAllowed case rejected instead of resolving to undefined.
  • corepack yarn workspace @aws-amplify/cli-internal test src/__tests__/commands/gen2-migration/_common/aws-fetcher.test.ts --runInBand --no-coverage
  • corepack yarn workspace @aws-amplify/cli-internal test src/__tests__/commands/gen2-migration/generate/amplify/storage/s3.generator.test.ts --runInBand --no-coverage
  • corepack yarn prettier --check packages/amplify-cli/src/commands/gen2-migration/_common/aws-fetcher.ts packages/amplify-cli/src/__tests__/commands/gen2-migration/_common/aws-fetcher.test.ts
  • corepack yarn eslint packages/amplify-cli/src/commands/gen2-migration/_common/aws-fetcher.ts packages/amplify-cli/src/__tests__/commands/gen2-migration/_common/aws-fetcher.test.ts --max-warnings=1500

Note: local git hooks call a yarn binary directly, while this environment only exposes Yarn through Corepack, so commit/push hooks were bypassed after running the focused checks above manually.

Checklist

  • PR description included
  • Tests are changed or added

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

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.

Gen1 to Gen2 migration fails with MethodNotAllowed error for S3 Transfer Acceleration in unsupported regions (eu-north-1)

1 participant