Field DeleteMarker in HeadObjectOutput is not usable #2872
Labels
bug
This issue is a bug.
p2
This is a standard priority issue
service-api
This issue is due to a problem in a service API, not the SDK implementation.
Describe the bug
The documentation for HeadObjectOutput says that the DeleteMarker field is true if the object is a delete marker.
However, HeadObject always returns an error for delete markers, and it returns a nil HeadObjectOutput when there is an error. This makes it impossible to use the DeleteMarker field to check whether HeadObject failed because the version is a delete marker.
This behavior is different than the behavior of aws-sdk-go, which returns both the output struct and the error when using HeadObject on a delete marker. Using aws-sdk-go, it is possible to check the fields of HeadObjectOutput even when there is an error.
Expected Behavior
I expect to be able to check the DeleteMarker field when using HeadObject on a delete marker.
Current Behavior
HeadObjectOutput is nil when using HeadObject on a delete marker.
Example output from the program below:
HeadObject output: <nil>
HeadObject error: operation error S3: HeadObject, https response error StatusCode: 405, RequestID: <...snip...>, HostID: <...snip...>, api error MethodNotAllowed: Method Not Allowed
Reproduction Steps
Run this program to test HeadObject on a delete marker:
go run main.go -bucket <bucket> -key <key> -version <version>
Possible Solution
No response
Additional Information/Context
No response
AWS Go SDK V2 Module Versions Used
github.com/aws/aws-sdk-go-v2 v1.25.2
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.5.4
github.com/aws/aws-sdk-go-v2/config v1.26.4
github.com/aws/aws-sdk-go-v2/credentials v1.16.15
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.14.11
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2
github.com/aws/aws-sdk-go-v2/internal/ini v1.7.2
github.com/aws/aws-sdk-go-v2/internal/v4a v1.2.10
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.2.10
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.2
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.16.10
github.com/aws/aws-sdk-go-v2/service/s3 v1.48.0
github.com/aws/aws-sdk-go-v2/service/sso v1.18.6
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.21.7
github.com/aws/aws-sdk-go-v2/service/sts v1.26.7
Compiler and Version used
go version go1.22.0 darwin/amd64
Operating System and version
macOS Sonoma 14.3
The text was updated successfully, but these errors were encountered: