aws-sdk-rust icon indicating copy to clipboard operation
aws-sdk-rust copied to clipboard

XML parsing Error when sending GetBucketLifecycleConfiguration operation in s3-sdk

Open yossyX opened this issue 1 year ago • 3 comments
trafficstars

Describe the bug

An error occurred while executing get_bucket_lifecycle_configuration.

Expected Behavior

The following rusoto_s3 code works fine.

let result = client
    .get_bucket_lifecycle_configuration(GetBucketLifecycleConfigurationRequest {
        bucket: "bucket_name".to_string(),
        expected_bucket_owner: None,
    })
    .await?;

Current Behavior

The following error is output.

service error

Caused by:
    0: unhandled error
    1: error parsing XML: expected union, got nothing

Reproduction Steps

let builder = aws_sdk_s3::config::Builder::from(&sdk_config);
let client = Client::from_conf(builder.force_path_style(true).build());
let result = client
    .get_bucket_lifecycle_configuration()
    .bucket("bucket_name")
    .send()
    .await?;

The force_path_style is set with reference to https://github.com/awslabs/aws-sdk-rust/issues/730, but the result is the same whether it is used or not. The client confirms that uploads and downloads are successful and AmazonS3FullAccess is set.

Possible Solution

No response

Additional Information/Context

No response

Version

├── aws-config v1.0.3
│   ├── aws-credential-types v1.0.3
│   │   ├── aws-smithy-async v1.0.3
│   │   ├── aws-smithy-runtime-api v1.0.3
│   │   │   ├── aws-smithy-async v1.0.3 (*)
│   │   │   ├── aws-smithy-types v1.0.3
│   │   ├── aws-smithy-types v1.0.3 (*)
│   ├── aws-http v0.60.0
│   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-types v1.0.3
│   │   │   ├── aws-credential-types v1.0.3 (*)
│   │   │   ├── aws-smithy-async v1.0.3 (*)
│   │   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   │   ├── aws-smithy-types v1.0.3 (*)
│   ├── aws-runtime v1.0.3
│   │   ├── aws-credential-types v1.0.3 (*)
│   │   ├── aws-http v0.60.0 (*)
│   │   ├── aws-sigv4 v1.0.3
│   │   │   ├── aws-credential-types v1.0.3 (*)
│   │   │   ├── aws-smithy-eventstream v0.60.0
│   │   │   │   ├── aws-smithy-types v1.0.3 (*)
│   │   │   ├── aws-smithy-http v0.60.0
│   │   │   │   ├── aws-smithy-eventstream v0.60.0 (*)
│   │   │   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   │   │   ├── aws-smithy-types v1.0.3 (*)
│   │   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-smithy-async v1.0.3 (*)
│   │   ├── aws-smithy-eventstream v0.60.0 (*)
│   │   ├── aws-smithy-http v0.60.0 (*)
│   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-types v1.0.3 (*)
│   ├── aws-sdk-sso v1.4.0
│   │   ├── aws-credential-types v1.0.3 (*)
│   │   ├── aws-http v0.60.0 (*)
│   │   ├── aws-runtime v1.0.3 (*)
│   │   ├── aws-smithy-async v1.0.3 (*)
│   │   ├── aws-smithy-http v0.60.0 (*)
│   │   ├── aws-smithy-json v0.60.0
│   │   │   └── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-smithy-runtime v1.0.3
│   │   │   ├── aws-smithy-async v1.0.3 (*)
│   │   │   ├── aws-smithy-http v0.60.0 (*)
│   │   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-types v1.0.3 (*)
│   ├── aws-sdk-ssooidc v1.4.0
│   │   ├── aws-credential-types v1.0.3 (*)
│   │   ├── aws-http v0.60.0 (*)
│   │   ├── aws-runtime v1.0.3 (*)
│   │   ├── aws-smithy-async v1.0.3 (*)
│   │   ├── aws-smithy-http v0.60.0 (*)
│   │   ├── aws-smithy-json v0.60.0 (*)
│   │   ├── aws-smithy-runtime v1.0.3 (*)
│   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-types v1.0.3 (*)
│   ├── aws-sdk-sts v1.4.0
│   │   ├── aws-credential-types v1.0.3 (*)
│   │   ├── aws-http v0.60.0 (*)
│   │   ├── aws-runtime v1.0.3 (*)
│   │   ├── aws-smithy-async v1.0.3 (*)
│   │   ├── aws-smithy-http v0.60.0 (*)
│   │   ├── aws-smithy-json v0.60.0 (*)
│   │   ├── aws-smithy-query v0.60.0
│   │   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-smithy-runtime v1.0.3 (*)
│   │   ├── aws-smithy-runtime-api v1.0.3 (*)
│   │   ├── aws-smithy-types v1.0.3 (*)
│   │   ├── aws-smithy-xml v0.60.0
│   │   ├── aws-types v1.0.3 (*)
│   ├── aws-smithy-async v1.0.3 (*)
│   ├── aws-smithy-http v0.60.0 (*)
│   ├── aws-smithy-json v0.60.0 (*)
│   ├── aws-smithy-runtime v1.0.3 (*)
│   ├── aws-smithy-runtime-api v1.0.3 (*)
│   ├── aws-smithy-types v1.0.3 (*)
│   ├── aws-types v1.0.3 (*)
├── aws-sdk-s3 v1.5.0
│   ├── aws-credential-types v1.0.3 (*)
│   ├── aws-http v0.60.0 (*)
│   ├── aws-runtime v1.0.3 (*)
│   ├── aws-sigv4 v1.0.3 (*)
│   ├── aws-smithy-async v1.0.3 (*)
│   ├── aws-smithy-checksums v0.60.0
│   │   ├── aws-smithy-http v0.60.0 (*)
│   │   ├── aws-smithy-types v1.0.3 (*)
│   ├── aws-smithy-eventstream v0.60.0 (*)
│   ├── aws-smithy-http v0.60.0 (*)
│   ├── aws-smithy-json v0.60.0 (*)
│   ├── aws-smithy-runtime v1.0.3 (*)
│   ├── aws-smithy-runtime-api v1.0.3 (*)
│   ├── aws-smithy-types v1.0.3 (*)
│   ├── aws-smithy-xml v0.60.0 (*)
│   ├── aws-types v1.0.3 (*)

Environment details (OS name and version, etc.)

Linux

Logs

No response

yossyX avatar Dec 11 '23 07:12 yossyX

Can you send the full error? (It will include the raw XML response). This appears to be a bug deserializing an internal component of the response related to your specific configuration. I wasn't able to reproduce this by playing around with a few different lifecycle configurations

rcoh avatar Dec 11 '23 16:12 rcoh

@rcoh Thank you for the prompt response. I have provided detailed output below. The contents of "_private" have been masked.

ServiceError(ServiceError { source: Unhandled(Unhandled { source: XmlDecodeError { kind: Custom("expected union, got nothing") }, meta: ErrorMetadata { code: None, message: None, extras: None } }), raw: Response { status: StatusCode(200), headers: Headers { headers: {"x-amz-id-2": HeaderValue { _private: "-------------" }, "x-amz-request-id": HeaderValue { _private: "-------------" }, "date": HeaderValue { _private: "Tue, 12 Dec 2023 01:30:37 GMT" }, "server": HeaderValue { _private: "AmazonS3" }, "content-length": HeaderValue { _private: "233" }} }, body: SdkBody { inner: Once(Some(b"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<LifecycleConfiguration xmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><Rule><ID>aa</ID><Filter/><Status>Enabled</Status><Expiration><Days>30</Days></Expiration></Rule></LifecycleConfiguration>")), retryable: true }, extensions: Extensions } })

yossyX avatar Dec 12 '23 01:12 yossyX

Turns out this is an upstream S3 issue: https://github.com/aws/aws-sdk/issues/582

Fixing it will either require making a breaking change to the S3 client or adding some custom behavior. We'll get back to you on where we end up.

rcoh avatar Dec 13 '23 20:12 rcoh