amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

CLI v14.0.0 XAmzContentSHA256Mismatch error in Amplify Console - related to AWS SDK v3 bug

Open shivennn opened this issue 2 months ago • 1 comments

How did you install the Amplify CLI?

npm

If applicable, what version of Node.js are you using?

v20.19.0

Amplify CLI Version

14.0.0 (failing while deploying on Amplify Console) / 13.0.0 (working)

What operating system are you using?

macOS

Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.

No manual changes made

Describe the bug

Amplify CLI v14.0.0 fails with XAmzContentSHA256Mismatch error only when deploying through Amplify Console. Local deployments using amplify push -y with CLI v14.0.0 work successfully. This appears to be related to the known AWS SDK v3 issue documented at https://github.com/aws/aws-sdk-js-v3/issues/6893. The error occurs during AppSync file uploads to S3 in the Console environment, specifically with complex GraphQL schemas that generate many files.

Expected behavior

Amplify Console deployments should work with CLI v14.0.0 just as they do with v13.0.0 and as local deployments do with v14.0.0.

Reproduction steps

  • Reproducible only for specific backend environment deployment for large schema and resolver changes

Project Identifier

No response

Log output

# Put your logs below this line
2025-10-17T12:59:51.261Z [WARNING]: - Building resource auth/insightsportal
2025-10-17T12:59:56.640Z [WARNING]: - Building resource storage/insightsportal
2025-10-17T13:00:03.364Z [WARNING]: - Uploading files.
2025-10-17T13:00:07.482Z [WARNING]: @smithy/node-http-handler:WARN - socket usage at capacity=50 and 2344 additional requests are enqueued.
                                    See https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/node-configuring-maxsockets.html
                                    or increase socketAcquisitionWarningTimeout=(millis) in the NodeHttpHandler config.
2025-10-17T13:00:09.424Z [WARNING]: ✖ There was an error initializing your environment.
2025-10-17T13:00:09.424Z [INFO]: 🛑 The provided 'x-amz-content-sha256' header does not match what was computed.
2025-10-17T13:00:09.425Z [INFO]: Learn more at: https://docs.amplify.aws/cli/project/troubleshooting/
                                 DeploymentFault: The provided 'x-amz-content-sha256' header does not match what was computed.
                                 at Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:362:11)
                                 at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
                                 The provided 'x-amz-content-sha256' header does not match what was computed.
2025-10-17T13:00:09.426Z [INFO]: XAmzContentSHA256Mismatch: The provided 'x-amz-content-sha256' header does not match what was computed.
                                 at throwDefaultError (/snapshot/amplify-cli/build/node_modules/@smithy/smithy-client/dist-cjs/index.js:388:20)
                                 at /snapshot/amplify-cli/build/node_modules/@smithy/smithy-client/dist-cjs/index.js:397:5
                                 at de_CommandError (/snapshot/amplify-cli/build/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:5202:14)
                                 at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
                                 at async /snapshot/amplify-cli/build/node_modules/@smithy/middleware-serde/dist-cjs/index.js:36:20
                                 at async /snapshot/amplify-cli/build/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:484:18
                                 at async /snapshot/amplify-cli/build/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
                                 at async /snapshot/amplify-cli/build/node_modules/@aws-sdk/middleware-flexible-checksums/dist-cjs/index.js:318:18
                                 at async /snapshot/amplify-cli/build/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:110:22
                                 at async /snapshot/amplify-cli/build/node_modules/@aws-sdk/middleware-sdk-s3/dist-cjs/index.js:137:14
                                 at async /snapshot/amplify-cli/build/node_modules/@aws-sdk/client-s3/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
                                 at async Promise.all (index 0)
                                 at async _Upload.__uploadUsingPut (/snapshot/amplify-cli/build/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js:259:22)
                                 at async _Upload.__doConcurrentUpload (/snapshot/amplify-cli/build/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js:333:16)
                                 at async Promise.all (index 0)
                                 at async _Upload.__doMultipartUpload (/snapshot/amplify-cli/build/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js:418:5)
                                 at async _Upload.done (/snapshot/amplify-cli/build/node_modules/@aws-sdk/lib-storage/dist-cjs/index.js:233:12)
                                 at async S3.uploadFile (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/aws-utils/aws-s3.js:127:7)
                                 at async upload (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/upload-appsync-files.js:183:16)
                                 at async handleFile (/snapshot/amplify-cli/build/node_modules/graphql-transformer-core/lib/util/fileUtils.js:87:16)
                                 at async /snapshot/amplify-cli/build/node_modules/graphql-transformer-core/lib/util/amplifyUtils.js:245:9
                                 at async Promise.all (index 96)
                                 at async Object.uploadDeployment (/snapshot/amplify-cli/build/node_modules/graphql-transformer-core/lib/util/amplifyUtils.js:247:5)
                                 at async uploadAppSyncFiles (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/upload-appsync-files.js:172:5)
                                 at async Object.run (/snapshot/amplify-cli/build/node_modules/@aws-amplify/amplify-provider-awscloudformation/lib/push-resources.js:211:5)
2025-10-17T13:00:09.445Z [INFO]: Session Identifier: f797cf35-ed1f-4707-bd94-6420e526bde2
2025-10-17T13:00:09.495Z [ERROR]: !!! Build failed

Additional information

Related AWS SDK Issue: This appears to be related to https://github.com/aws/aws-sdk-js-v3/issues/6893 - SHA256 checksum mismatch in multipart uploads

Environment-specific: Only affects Amplify Console deployments, not local deployments

Local vs Console: amplify push -y with CLI v14.0.0 works locally but fails in Console

SDK Version Dependency: CLI v14.0.0 likely uses a newer AWS SDK v3 version that has this regression

Socket Exhaustion: Console environment hits socket limits (993 requests enqueued) during bulk file uploads

Workarounds

  1. Use CLI v13.0.1 in Console for Amplify CI/CD build
  2. Deploy the backend from local system using amplify push -y with Amplify CLI version 14.0.0 or latest and skip the backend deployment on Amplify Console as per Automatic build-time generation of Amplify config (Gen 1 apps only)

Before submitting, please confirm:

  • [x] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
  • [x] I have removed any sensitive information from my code snippets and submission.

shivennn avatar Oct 21 '25 20:10 shivennn

Hi @shivennn,

Thank you for the detailed report and for identifying the connection to the AWS SDK v3 issue. This appears to be a valid concern related to how CLI v14.0.0 handles S3 uploads in resource-constrained environments like Amplify Console.

The evidence suggests this is related to the Upload class from @aws-sdk/lib-storage v3.624.0 encountering checksum calculation issues when socket capacity is exhausted during concurrent multipart uploads. The warning about 2344 enqueued requests with only 50 available sockets indicates the Console environment is hitting resource limits that don't occur in local environments.

Potential Solutions:

Your workarounds are appropriate - either use CLI v13.0.1 in Console or deploy from local with v14.0.0

We'll investigate this and post here if we have any updates.

pahud avatar Oct 22 '25 16:10 pahud