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 HeadObject fails to deserialize 404s #456

Closed
jdisanti opened this issue Jun 3, 2021 · 2 comments · Fixed by #460
Closed

S3 HeadObject fails to deserialize 404s #456

jdisanti opened this issue Jun 3, 2021 · 2 comments · Fixed by #460
Labels
bug Something isn't working

Comments

@jdisanti
Copy link
Collaborator

jdisanti commented Jun 3, 2021

I encountered this on both v0.0.5-alpha and v0.0.6-alpha.

The S3 HeadObject operation fails with the following when an object doesn't exist:

Error parsing XML: no root element

Trace:

Jun 02 21:05:57.853 TRACE smithy_http_tower::dispatch: request=Request { method: HEAD, uri: https://s3.us-west-2.amazonaws.com/test-bucket-4d39b6e4-9e3d-4496-a8c8-a6a4ceea620e/test-wedger-s3/893faf94bac34607b188e8598507865d01b5900b562d4ac3e53e53691f32c743.gz.encrypted, version: HTTP/1.1, headers: {"content-type": "application/xml", "content-length": "0", "host": "s3.us-west-2.amazonaws.com", "user-agent": "aws-sdk-rust/0.1.0 os/linux lang/rust/1.52.1", "x-amz-user-agent": "aws-sdk-rust/0.1.0 api/s3/0.0.5-alpha os/linux lang/rust/1.52.1", "authorization": Sensitive, "x-amz-date": "20210603T040557Z", "x-amz-content-sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}, body: SdkBody { inner: Once(Some(b"")), retryable: true } }

Jun 02 21:05:58.073 TRACE smithy_http::middleware: response=Response { 
  status: 404, version: HTTP/1.1, 
  headers: {
     "x-amz-request-id": "GRZ6BZ468DF52F2E", "x-amz-id-2": 
     "UTniwu6QmCIjVeuK2ZfeWBOnu7SqMQOS3Vac6B/K4H2ZCawYUl+nDbhGTImuyhZ5DFiojR3Kcz4=", 
     "content-type": "application/xml", 
     "date": "Thu, 03 Jun 2021 04:05:52 GMT", 
     "server": "AmazonS3"
   }, 
   body: SdkBody { inner: Streaming(Body(Empty)), retryable: false } 
}

It looks like the generated code is expecting a body when S3 doesn't respond with one:
https://github.com/awslabs/aws-sdk-rust/blob/main/sdk/s3/src/operation_deser.rs#L1916

@rcoh
Copy link
Collaborator

rcoh commented Jun 3, 2021

oh good catch. I think our empty body logic for XML must be wrong.

@rcoh rcoh added the bug Something isn't working label Jun 3, 2021
@rcoh
Copy link
Collaborator

rcoh commented Jun 3, 2021

this is actually a bit more subtle, it happens because S3 is returning an empty 404 error and I'm not sure how the SDK is supposed to know that's going to happen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants