Unable to parse ExceptionName: XAmzContentSHA256Mismatch Message:

Open
#7,391 1 comment 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 2 days

@beqqrry-aws is already working on this.

Since Apr 16, 2025.

Assessment

This issue has not been assessed yet.

Description

Bug C++
Expected behavior

just putobject

Actual behavior

1

Steps to reproduce
bool AWSS3Manager::putObject(const Aws::String &bucketName, const Aws::String &fileName)
{
    Aws::S3::Model::PutObjectRequest request;
    request.SetBucket(bucketName);
    request.SetKey(fileName);

    // std::shared_ptr<Aws::IOStream> inputData =
    //     Aws::MakeShared<Aws::FStream>("SampleAllocationTag",
    //                                   fileName.c_str(),
    //                                   std::ios_base::in | std::ios_base::binary);

    // if (!*inputData)
    // {
    //     std::cerr << "Error unable to read file " << fileName << std::endl;
    //     return false;
    // }

    // request.SetBody(inputData);
    auto input_data = Aws::MakeShared<Aws::FStream>("PutObjectInputStream", fileName.c_str(), std::ios_base::in | std::ios_base::binary);
    request.SetBody(input_data);

    Aws::S3::Model::PutObjectOutcome outcome =
        client->PutObject(request);

    if (!outcome.IsSuccess())
    {
        std::cerr << "Error: putObject: " << outcome.GetError().GetMessage() << std::endl;
    }
    else
    {
        std::cout << "Added object '" << fileName << "' to bucket '"
                  << bucketName << "'.";
    }

    return outcome.IsSuccess();
}
Logs / stacktrace (if applicable)

Which SDK were you using?

C++

Which OS were you using?

Linux

SDK version

1.11.526

OS version

centos8

Dominant language
Java
Stars
10.5k
Forks
5.8k
Avg merge
2d 21h
Merged PRs (30d)
30

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from awsdocs/aws-doc-sdk-examples

All issues in awsdocs/aws-doc-sdk-examples

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.