Skip to content

S3 get_object_attributes error parsing XML #609

@jaketreacher

Description

@jaketreacher

Describe the bug

Attempting to query S3 object attributes. It results in an error: Error parsing XML.

Expected Behavior

I receive S3 Object Attributes.

Current Behavior

An error occurs.

Reproduction Steps

Make a get_object_attributes request to an existing bucket/key.

s3_client.get_object_attributes()
    .bucket("my_bucket")
    .key("my_key")
    .object_attributes(ObjectAttributes::Checksum)
    .send()
    .await
    .unwrap();

Possible Solution

No response

Additional Information/Context

No response

Version

cargo tree | grep aws-
│   ├── aws-sig-auth v0.8.0
│   │   ├── aws-sigv4 v0.8.0
│   │   │   ├── aws-smithy-http v0.38.0
│   │   │   │   ├── aws-smithy-types v0.38.0
│   │   ├── aws-smithy-http v0.38.0 (*)
│   │   ├── aws-types v0.8.0
│   │   │   ├── aws-smithy-async v0.38.0
│   │   │   ├── aws-smithy-client v0.38.0
│   │   │   │   ├── aws-smithy-async v0.38.0 (*)
│   │   │   │   ├── aws-smithy-http v0.38.0 (*)
│   │   │   │   ├── aws-smithy-http-tower v0.38.0
│   │   │   │   │   ├── aws-smithy-http v0.38.0 (*)
│   │   │   │   ├── aws-smithy-types v0.38.0 (*)
│   │   │   ├── aws-smithy-types v0.38.0 (*)
│   ├── aws-smithy-async v0.38.0 (*)
│   ├── aws-smithy-client v0.38.0 (*)
│   ├── aws-smithy-http v0.38.0 (*)
│   ├── aws-smithy-http-tower v0.38.0 (*)
│   ├── aws-smithy-types v0.38.0 (*)
│   ├── aws-types v0.8.0 (*)
├── aws-config v0.47.0
│   ├── aws-http v0.47.0
│   │   ├── aws-smithy-http v0.47.0
│   │   │   ├── aws-smithy-eventstream v0.47.0
│   │   │   │   ├── aws-smithy-types v0.47.0
│   │   │   ├── aws-smithy-types v0.47.0 (*)
│   │   ├── aws-smithy-types v0.47.0 (*)
│   │   ├── aws-types v0.47.0
│   │   │   ├── aws-smithy-async v0.47.0
│   │   │   ├── aws-smithy-client v0.47.0
│   │   │   │   ├── aws-smithy-async v0.47.0 (*)
│   │   │   │   ├── aws-smithy-http v0.47.0 (*)
│   │   │   │   ├── aws-smithy-http-tower v0.47.0
│   │   │   │   │   ├── aws-smithy-http v0.47.0 (*)
│   │   │   │   ├── aws-smithy-types v0.47.0 (*)
│   │   │   ├── aws-smithy-http v0.47.0 (*)
│   │   │   ├── aws-smithy-types v0.47.0 (*)
│   ├── aws-sdk-sso v0.17.0
│   │   ├── aws-endpoint v0.47.0
│   │   │   ├── aws-smithy-http v0.47.0 (*)
│   │   │   ├── aws-types v0.47.0 (*)
│   │   ├── aws-http v0.47.0 (*)
│   │   ├── aws-sig-auth v0.47.0
│   │   │   ├── aws-sigv4 v0.47.0
│   │   │   │   ├── aws-smithy-eventstream v0.47.0 (*)
│   │   │   │   ├── aws-smithy-http v0.47.0 (*)
│   │   │   ├── aws-smithy-eventstream v0.47.0 (*)
│   │   │   ├── aws-smithy-http v0.47.0 (*)
│   │   │   ├── aws-types v0.47.0 (*)
│   │   ├── aws-smithy-async v0.47.0 (*)
│   │   ├── aws-smithy-client v0.47.0 (*)
│   │   ├── aws-smithy-http v0.47.0 (*)
│   │   ├── aws-smithy-http-tower v0.47.0 (*)
│   │   ├── aws-smithy-json v0.47.0
│   │   │   └── aws-smithy-types v0.47.0 (*)
│   │   ├── aws-smithy-types v0.47.0 (*)
│   │   ├── aws-types v0.47.0 (*)
│   ├── aws-sdk-sts v0.17.0
│   │   ├── aws-endpoint v0.47.0 (*)
│   │   ├── aws-http v0.47.0 (*)
│   │   ├── aws-sig-auth v0.47.0 (*)
│   │   ├── aws-smithy-async v0.47.0 (*)
│   │   ├── aws-smithy-client v0.47.0 (*)
│   │   ├── aws-smithy-http v0.47.0 (*)
│   │   ├── aws-smithy-http-tower v0.47.0 (*)
│   │   ├── aws-smithy-query v0.47.0
│   │   │   ├── aws-smithy-types v0.47.0 (*)
│   │   ├── aws-smithy-types v0.47.0 (*)
│   │   ├── aws-smithy-xml v0.47.0
│   │   ├── aws-types v0.47.0 (*)
│   ├── aws-smithy-async v0.47.0 (*)
│   ├── aws-smithy-client v0.47.0 (*)
│   ├── aws-smithy-http v0.47.0 (*)
│   ├── aws-smithy-http-tower v0.47.0 (*)
│   ├── aws-smithy-json v0.47.0 (*)
│   ├── aws-smithy-types v0.47.0 (*)
│   ├── aws-types v0.47.0 (*)
├── aws-sdk-s3 v0.17.0
│   ├── aws-endpoint v0.47.0 (*)
│   ├── aws-http v0.47.0 (*)
│   ├── aws-sig-auth v0.47.0 (*)
│   ├── aws-sigv4 v0.47.0 (*)
│   ├── aws-smithy-async v0.47.0 (*)
│   ├── aws-smithy-checksums v0.47.0
│   │   ├── aws-smithy-http v0.47.0 (*)
│   │   ├── aws-smithy-types v0.47.0 (*)
│   ├── aws-smithy-client v0.47.0 (*)
│   ├── aws-smithy-eventstream v0.47.0 (*)
│   ├── aws-smithy-http v0.47.0 (*)
│   ├── aws-smithy-http-tower v0.47.0 (*)
│   ├── aws-smithy-types v0.47.0 (*)
│   ├── aws-smithy-xml v0.47.0 (*)
│   ├── aws-types v0.47.0 (*)

Environment details (OS name and version, etc.)

AL2

Logs

message=Error parsing XML: invalid root, expected GetObjectAttributesOutput got StartEl { name: Name { prefix: "", local: "GetObjectAttributesResponse" }, attributes: [Attr { name: Name { prefix: "", local: "xmlns" }, value: "http://s3.amazonaws.com/doc/2006-03-01/" }], closed: false, depth: 0 }
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ServiceError { err: GetObjectAttributesError { kind: Unhandled(Custom("invalid root, expected GetObjectAttributesOutput got StartEl { name: Name { prefix: \"\", local: \"GetObjectAttributesResponse\" }, attributes: [Attr { name: Name { prefix: \"\", local: \"xmlns\" }, value: \"http://s3.amazonaws.com/doc/2006-03-01/\" }], closed: false, depth: 0 }")), meta: Error { code: None, message: None, request_id: None, extras: {} } }, raw: Response { inner: Response { status: 200, version: HTTP/1.1, headers: {"x-amz-id-2": "1nyU53SoiSBV2SeSnGdpr95cAmCSmdMTQD0nDfqpeaJZkgKfo/aYHdy/wCtRyOncvVc1ijYRq+Q=", "x-amz-request-id": "6SW9505AEYDB6CWD", "date": "Tue, 23 Aug 2022 01:01:52 GMT", "last-modified": "Tue, 23 Aug 2022 00:41:50 GMT", "server": "AmazonS3", "content-length": "244"}, body: SdkBody { inner: Once(Some(b"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<GetObjectAttributesResponse xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Checksum><ChecksumSHA256>sOvNvkEhZKZenCcdBmS1115cgn7r2Mja3ZL7psTuncw=</ChecksumSHA256></Checksum></GetObjectAttributesResponse>")), retryable: true } }, properties: SharedPropertyBag(Mutex { data: PropertyBag, poisoned: false, .. }) } }', src/main.rs:63:10

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions