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

S3:GetObject - No Supported Checksum when using IfNoneMatch (ETag) #3024

Open
2 of 3 tasks
bwagner5 opened this issue Mar 2, 2025 · 0 comments
Open
2 of 3 tasks

S3:GetObject - No Supported Checksum when using IfNoneMatch (ETag) #3024

bwagner5 opened this issue Mar 2, 2025 · 0 comments
Labels
needs-triage This issue or PR still needs to be triaged.

Comments

@bwagner5
Copy link

bwagner5 commented Mar 2, 2025

Acknowledgements

Related to this but appears to be enabled by default now: #1606

Describe the bug

When calling S3 GetObject and using the IfNoneMatch (for ETag caching) the SDK logs a warn message:

SDK 2025/03/02 02:10:31 WARN Response has no supported checksum. Not validating response payload.

If you remove the IfNoneMatch and the object is actually fetched, the WARN log is not printed since the checksum validation is performed properly.

Regression Issue

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

Expected Behavior

The log should not be printed in cases where the object is not actually fetched.

WARN Response has no supported checksum. Not validating response payload.

Current Behavior

Prints the log when an object is not fetched due to IfNoneMatch (Not Modified). I haven't tested other ways to prevent the actual object fetch, but I suspect the same issue occurs with those.

WARN Response has no supported checksum. Not validating response payload.

Reproduction Steps

Here's a simple program to demonstrate:

package main

import (
	"context"
	"flag"
	"fmt"
	"log"
	"os"

	"github.com/aws/aws-sdk-go-v2/config"
	"github.com/aws/aws-sdk-go-v2/service/s3"
)

func main() {
	bucket := flag.String("bucket", "", "S3 bucket")
	key := flag.String("key", "", "S3 key")
	region := flag.String("region", os.Getenv("AWS_REGION"), "AWS Regon")
	etag := flag.String("etag", "", "ETag")
	flag.Parse()

	ctx := context.Background()
	cfg, err := config.LoadDefaultConfig(ctx, config.WithRegion(*region))
	if err != nil {
		log.Fatalf("failed to load AWS config %s", err)
	}

	s3Client := s3.NewFromConfig(cfg)

	getObjInput := &s3.GetObjectInput{
		Bucket: bucket,
		Key:    key,
	}
	if *etag != "" {
		getObjInput.IfNoneMatch = etag
	}
	out, err := s3Client.GetObject(ctx, getObjInput)
	if err != nil {
		log.Fatalf("GetObject error %s", err)
	}
	fmt.Println(string(*out.ETag))
}

>  go run main.go --bucket <any-bucket> --key <any-key>
"b6a75ac7399fa1cae64703727df347e8"
>  go run main.go --bucket <any-bucket> --key <any-key> --etag b6a75ac7399fa1cae64703727df347e8
SDK 2025/03/02 02:10:31 WARN Response has no supported checksum. Not validating response payload.
2025/03/02 02:10:31 GetObject error operation error S3: GetObject, https response error StatusCode: 304, RequestID: DQSFW41K4QJ9124E, HostID: eernRlMJrXAXxwWuJfuB2CPwGU0SY/iTT20RjIMYpueu7pKDFy4KxWpSG23vTscN6Bn7cbhqo8E=, api error NotModified: Not Modified

Possible Solution

No response

Additional Information/Context

I can work around with this, but it's annoying to have to do this:

s3Client := s3.NewFromConfig(cfg, func(o *s3.Options) {
	o.DisableLogOutputChecksumValidationSkipped = true
})

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.36.2
github.com/aws/aws-sdk-go-v2/config v1.29.7
github.com/aws/aws-sdk-go-v2/service/s3 v1.77.1
github.com/aws/smithy-go v1.22.2

Compiler and Version used

go version go1.23.6 linux/amd64

Operating System and version

AL2 5.10.234-205.895.amzn2int.x86_64

@bwagner5 bwagner5 added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Mar 2, 2025
@adev-code adev-code self-assigned this Mar 3, 2025
@adev-code adev-code added investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. and removed needs-triage This issue or PR still needs to be triaged. investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Mar 3, 2025
@adev-code adev-code removed their assignment Mar 3, 2025
@lucix-aws lucix-aws removed the bug This issue is a bug. label Mar 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants