Skip to content

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

Closed
@bwagner5

Description

@bwagner5

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions