aws-sdk-rust
aws-sdk-rust copied to clipboard
S3 get_object_attributes error parsing XML
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
looks like a bug, thanks for reporting we'll get a fix out
@jaketreacher This issue is caused by the fact that S3 isn't returning XML in the form specified by their model and the Rust SDK validates response XML. Most other SDKs ignore name mismatch issues with the response XML's root element. We can address this issue by suppressing that validation for S3 specifically. I'm going to look into what that would entail.
Thanks for surfacing this issue!
I have a fix for this https://github.com/awslabs/smithy-rs/pull/1665 If it gets merged by tomorrow, I'll run a release.
The fix for this went out with the 2022-08-31 release. Thanks again for reporting this!
⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.