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

s3control/GetStorageLensConfiguration: UnmarshalError: failed to unmarshal error message #4577

Open
ewbankkit opened this issue Oct 5, 2022 · 2 comments
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.

Comments

@ewbankkit
Copy link

Describe the bug

When attempting to deserialize the error response from an S3 Control GetStorageLensConfiguration API call the Go SDK hits an umarshaling error:

2022/10/05 09:25:14 [DEBUG] [aws-sdk-go] DEBUG: Request S3 Control/GetStorageLensConfiguration Details:
---[ REQUEST POST-SIGN ]-----------------------------
GET /v20180820/storagelens/tf-acc-test-671724957310672593 HTTP/1.1
Host: ************.s3-control.us-west-2.amazonaws.com
User-Agent: APN/1.0 HashiCorp/1.0 Terraform/1.0.9 (+https://www.terraform.io) terraform-provider-aws/dev (+https://registry.terraform.io/providers/hashicorp/aws) aws-sdk-go/1.44.108 (go1.18.4; darwin; amd64)
Authorization: ************
X-Amz-Account-Id: ************
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20221005T132514Z
X-Amz-Security-Token: ************
Accept-Encoding: gzip


-----------------------------------------------------
2022/10/05 09:25:14 [DEBUG] [aws-sdk-go] DEBUG: Response S3 Control/GetStorageLensConfiguration Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 404 Not Found
Content-Length: 241
Content-Type: application/xml
Date: Wed, 05 Oct 2022 13:25:15 GMT
Server: AmazonS3
X-Amz-Id-2: c+/FUPJMiEp+ElTGaB/sr0OMsiPj9kCXsr9Wdg872DH4ZkaKPeGACTRyZW8/stzG6/ZuN40PMTw=
X-Amz-Request-Id: XEZTMJAP03HQADT5


-----------------------------------------------------
2022/10/05 09:25:14 [DEBUG] [aws-sdk-go] <Error><Code>NoSuchConfiguration</Code><Message>The specified configuration does not exist.</Message><RequestId>XEZTMJAP03HQADT5</RequestId><HostId>c+/FUPJMiEp+ElTGaB/sr0OMsiPj9kCXsr9Wdg872DH4ZkaKPeGACTRyZW8/stzG6/ZuN40PMTw=</HostId></Error>
2022/10/05 09:25:14 [DEBUG] [aws-sdk-go] DEBUG: Validate Response S3 Control/GetStorageLensConfiguration failed, attempt 0/25, error SerializationError: failed to unmarshal error message
	status code: 404, request id: XEZTMJAP03HQADT5, host id: c+/FUPJMiEp+ElTGaB/sr0OMsiPj9kCXsr9Wdg872DH4ZkaKPeGACTRyZW8/stzG6/ZuN40PMTw=
caused by: UnmarshalError: failed to unmarshal error message
	00000000  3c 45 72 72 6f 72 3e 3c  43 6f 64 65 3e 4e 6f 53  |<Error><Code>NoS|
00000010  75 63 68 43 6f 6e 66 69  67 75 72 61 74 69 6f 6e  |uchConfiguration|
00000020  3c 2f 43 6f 64 65 3e 3c  4d 65 73 73 61 67 65 3e  |</Code><Message>|
00000030  54 68 65 20 73 70 65 63  69 66 69 65 64 20 63 6f  |The specified co|
00000040  6e 66 69 67 75 72 61 74  69 6f 6e 20 64 6f 65 73  |nfiguration does|
00000050  20 6e 6f 74 20 65 78 69  73 74 2e 3c 2f 4d 65 73  | not exist.</Mes|
00000060  73 61 67 65 3e 3c 52 65  71 75 65 73 74 49 64 3e  |sage><RequestId>|
00000070  58 45 5a 54 4d 4a 41 50  30 33 48 51 41 44 54 35  |XEZTMJAP03HQADT5|
00000080  3c 2f 52 65 71 75 65 73  74 49 64 3e 3c 48 6f 73  |</RequestId><Hos|
00000090  74 49 64 3e 63 2b 2f 46  55 50 4a 4d 69 45 70 2b  |tId>c+/FUPJMiEp+|
000000a0  45 6c 54 47 61 42 2f 73  72 30 4f 4d 73 69 50 6a  |ElTGaB/sr0OMsiPj|
000000b0  39 6b 43 58 73 72 39 57  64 67 38 37 32 44 48 34  |9kCXsr9Wdg872DH4|
000000c0  5a 6b 61 4b 50 65 47 41  43 54 52 79 5a 57 38 2f  |ZkaKPeGACTRyZW8/|
000000d0  73 74 7a 47 36 2f 5a 75  4e 34 30 50 4d 54 77 3d  |stzG6/ZuN40PMTw=|
000000e0  3c 2f 48 6f 73 74 49 64  3e 3c 2f 45 72 72 6f 72  |</HostId></Error|
000000f0  3e                                                |>|

caused by: unknown error response tag, {{ Error} []}
2022/10/05 09:25:14 [DEBUG] [aws-sdk-go] DEBUG: Retrying Request S3 Control/GetStorageLensConfiguration, attempt 1

Expected Behavior

A correctly formed NoSuchConfiguration error should be returned from the API call.

Current Behavior

The API call goes into a (25 iteration) retry loop.

Reproduction Steps

  • Create an S3 Storage Lens Configuration
  • Delete it
  • Make the GetStorageLensConfiguration call specifying the ID of the configuration created above

Possible Solution

No response

Additional Information/Context

No response

SDK version used

1.44.110

Environment details (Version of Go (go version)? OS name and version, etc.)

go version go1.18.4 darwin/amd64

@ewbankkit ewbankkit added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Oct 5, 2022
@ewbankkit
Copy link
Author

Other Storage Lens APIs exhibit the same behavior:

022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: [DEBUG] [aws-sdk-go] DEBUG: Response S3 Control/PutStorageLensConfiguration Details:
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: ---[ RESPONSE ]--------------------------------------
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: HTTP/1.1 400 Bad Request
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: Connection: close
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: Content-Length: 258
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: Content-Type: application/xml
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: Date: Thu, 06 Oct 2022 12:59:44 GMT
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: Server: AmazonS3
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: X-Amz-Id-2: 1d3v5OUKlTzomG4lP18urS9DBcpwxvbzB2cZhk7hRBo3CjCqM6AI81WiXNpDK1ZTaUv0/vw2K4E=
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: X-Amz-Request-Id: R7QQHZXYMX0SHQBJ
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: -----------------------------------------------------
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: [DEBUG] [aws-sdk-go] <Error><Code>ActivityMetricsMustEnabled</Code><Message>Activity metrics must be enabled when it is requested</Message><RequestId>R7QQHZXYMX0SHQBJ</RequestId><HostId>1d3v5OUKlTzomG4lP18urS9DBcpwxvbzB2cZhk7hRBo3CjCqM6AI81WiXNpDK1ZTaUv0/vw2K4E=</HostId></Error>
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: [DEBUG] [aws-sdk-go] DEBUG: Validate Response S3 Control/PutStorageLensConfiguration failed, attempt 4/25, error SerializationError: failed to unmarshal error message
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 	status code: 400, request id: R7QQHZXYMX0SHQBJ, host id: 1d3v5OUKlTzomG4lP18urS9DBcpwxvbzB2cZhk7hRBo3CjCqM6AI81WiXNpDK1ZTaUv0/vw2K4E=
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: caused by: UnmarshalError: failed to unmarshal error message
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 	00000000  3c 45 72 72 6f 72 3e 3c  43 6f 64 65 3e 41 63 74  |<Error><Code>Act|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000010  69 76 69 74 79 4d 65 74  72 69 63 73 4d 75 73 74  |ivityMetricsMust|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000020  45 6e 61 62 6c 65 64 3c  2f 43 6f 64 65 3e 3c 4d  |Enabled</Code><M|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000030  65 73 73 61 67 65 3e 41  63 74 69 76 69 74 79 20  |essage>Activity |
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000040  6d 65 74 72 69 63 73 20  6d 75 73 74 20 62 65 20  |metrics must be |
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000050  65 6e 61 62 6c 65 64 20  77 68 65 6e 20 69 74 20  |enabled when it |
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000060  69 73 20 72 65 71 75 65  73 74 65 64 3c 2f 4d 65  |is requested</Me|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000070  73 73 61 67 65 3e 3c 52  65 71 75 65 73 74 49 64  |ssage><RequestId|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000080  3e 52 37 51 51 48 5a 58  59 4d 58 30 53 48 51 42  |>R7QQHZXYMX0SHQB|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000090  4a 3c 2f 52 65 71 75 65  73 74 49 64 3e 3c 48 6f  |J</RequestId><Ho|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 000000a0  73 74 49 64 3e 31 64 33  76 35 4f 55 4b 6c 54 7a  |stId>1d3v5OUKlTz|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 000000b0  6f 6d 47 34 6c 50 31 38  75 72 53 39 44 42 63 70  |omG4lP18urS9DBcp|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 000000c0  77 78 76 62 7a 42 32 63  5a 68 6b 37 68 52 42 6f  |wxvbzB2cZhk7hRBo|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 000000d0  33 43 6a 43 71 4d 36 41  49 38 31 57 69 58 4e 70  |3CjCqM6AI81WiXNp|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 000000e0  44 4b 31 5a 54 61 55 76  30 2f 76 77 32 4b 34 45  |DK1ZTaUv0/vw2K4E|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 000000f0  3d 3c 2f 48 6f 73 74 49  64 3e 3c 2f 45 72 72 6f  |=</HostId></Erro|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 00000100  72 3e                                             |r>|
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: 
2022-10-06T08:59:43.271-0400 [DEBUG] provider.terraform-provider-aws: caused by: unknown error response tag, {{ Error} []}

@RanVaknin
Copy link
Contributor

RanVaknin commented Feb 10, 2023

Hi @ewbankkit ,

Thanks for opening this.

This issue is happening because the s3control service returns the error in an unwrapped format.
In your case:

<Error>
	<Code>ActivityMetricsMustEnabled</Code>
	<Message>Activity metrics must be enabled when it is requested</Message>
	<RequestId>REDACTED</RequestId>
	<HostId>REDACTED=</HostId>
</Error>

The top level xml tag should be <ErrorResponse> according to Smithy's restXML protocol, or indicated noErrorWrapping in their model.

Should be:

<ErrorResponse>
	<Error>
		<Code>ActivityMetricsMustEnabled</Code>
		<Message>Activity metrics must be enabled when it is requested</Message>
		<RequestId>REDACTED</RequestId>
		<HostId>REDACTED</HostId>
	</Error>
</ErrorResponse>

The SDK is not expecting this top level tag, and is hitting this serialization error.

I will cut a ticket to the s3control service team in hopes of getting this fixed.

Thanks for your engagement!
Ran~

P81326037

@RanVaknin RanVaknin added service-api This issue is due to a problem in a service API, not the SDK implementation. and removed needs-triage This issue or PR still needs to be triaged. labels Feb 10, 2023
@aajtodd aajtodd self-assigned this Feb 13, 2023
@RanVaknin RanVaknin added the p2 This is a standard priority issue label Mar 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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.
Projects
None yet
Development

No branches or pull requests

3 participants