Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnonymousAWSCredentials do not support this operation #3696

Closed
1 task done
zlistiev opened this issue Mar 7, 2025 · 3 comments
Closed
1 task done

AnonymousAWSCredentials do not support this operation #3696

zlistiev opened this issue Mar 7, 2025 · 3 comments
Labels
bug This issue is a bug. potential-regression Marking this issue as a potential regression to be checked by team member s3

Comments

@zlistiev
Copy link

zlistiev commented Mar 7, 2025

Describe the bug

After upgrading AWSSDK.S3 to the latest version (3.7.415.13) it triggers exception "AnonymousAWSCredentials do not support this operation" when uploading to S3 bucket. Was fine at version 3.7.305.31.

var credentails = new AnonymousAWSCredentials();
_client = new AmazonS3ClientWrapper(new AmazonS3Client(credentails, region));

await _client.PutObjectAsync(new PutObjectRequest
{
				BucketName = bucketName,
				Key = s3Key,
				FilePath = file?.FilePath,
				CannedACL = somecannedacl
});

Regression Issue

  • Select this option if this issue appears to be a regression.

Expected Behavior

Object should be successfully uploaded using anonymous credentials

Current Behavior

PutObjectAsync throws "AnonymousAWSCredentials do not support this operation" exception when trying to upload object using anonymous credentials

Reproduction Steps

var credentails = new AnonymousAWSCredentials();
_client = new AmazonS3ClientWrapper(new AmazonS3Client(credentails, region));

await _client.PutObjectAsync(new PutObjectRequest
{
				BucketName = bucketName,
				Key = s3Key,
				FilePath = file?.FilePath,
				CannedACL = somecannedacl
});

Possible Solution

No response

Additional Information/Context

No response

AWS .NET SDK and/or Package version used

AWSSDK.S3 3.7.415.13

Targeted .NET Platform

.NET Framework 4.7.2

Operating System and version

Windows 11

@zlistiev zlistiev added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 7, 2025
@github-actions github-actions bot added the potential-regression Marking this issue as a potential regression to be checked by team member label Mar 7, 2025
@dscpinheiro
Copy link
Contributor

The error message isn't great, but this is related to the S3 default integrity change we released a couple of months ago: #3610

The SDK now calculates checksums by default (and adds extra headers before sending the request to S3), but since you're using anonymous credentials the headers will be empty. I enabled debug logging and saw the actual error:

AmazonS3Client 35|2025-03-07T07:18:20.975Z|ERROR|Received error response: [<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidRequest</Code><Message>x-amz-sdk-checksum-algorithm specified, but no corresponding x-amz-checksum-* or x-amz-trailer headers were found.</Message><RequestId>KMXP5K03CD08YXRN</RequestId><HostId>13aJ8hoZl9ZnTITq4AEBfWJXo3bBurr4qcaIJjQAjXB+R7adO0ve9ztLScoceh57yF50k1GuejQ=</HostId></Error>]

We're taking a look, for a workaround you can set the RequestChecksumCalculation option in the AmazonS3Config to WHEN_REQUIRED.

@dscpinheiro dscpinheiro added s3 and removed needs-triage This issue or PR still needs to be triaged. labels Mar 7, 2025
@dscpinheiro
Copy link
Contributor

Today's release (https://www.nuget.org/packages/AWSSDK.S3/3.7.415.14) includes a fix for this issue, I just tried the example again and it succeeded.

Copy link

github-actions bot commented Mar 7, 2025

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. potential-regression Marking this issue as a potential regression to be checked by team member s3
Projects
None yet
Development

No branches or pull requests

2 participants