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

Cloud9 NotFoundException deserialization error #2476

Closed
ewbankkit opened this issue Feb 1, 2024 · 3 comments · Fixed by #2489
Closed

Cloud9 NotFoundException deserialization error #2476

ewbankkit opened this issue Feb 1, 2024 · 3 comments · Fixed by #2489
Assignees
Labels
bug This issue is a bug. p1 This is a high priority issue

Comments

@ewbankkit
Copy link

Describe the bug

The Cloud9 NotFoundException error is not being deserialized correctly.
A JSON response of

{"__type":"NotFoundException","className":"NotFound","code":404,"message":"Unable to find [289ff5bae55240f89da9cddb1951fda4] in database."}

does not return a types.NotFoundException, instead at the Go SDK level we get

request failed with unretryable error https response error StatusCode: 400, RequestID: 1c2eb684-9adb-4f01-9b37-8c5940f45472, deserialization failed, failed to decode response body, json: cannot unmarshal number into Go struct field .Code of type string

Expected Behavior

Expected types.NotFoundException to be returned as a Go error.

Current Behavior

See above.

Reproduction Steps

Call cloud9.DescribeEnvironments() with a non-existent environment ID.

Possible Solution

No response

Additional Information/Context

No response

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2/service/cloud9 v1.22.7

Compiler and Version used

go version go1.20.10 darwin/amd64

Operating System and version

macOS Ventura 13.6

@RanVaknin
Copy link
Contributor

RanVaknin commented Feb 6, 2024

Hi @ewbankkit ,

Thanks for reaching out. I logged the raw response before it gets deserialized by the SDK and it looks like this:

SDK 2024/02/06 11:28:52 DEBUG Response
HTTP/2.0 400 Bad Request
Content-Length: 123
Content-Type: application/x-amz-json-1.1
Date: Tue, 06 Feb 2024 19:28:52 GMT
X-Amzn-Requestid: REDACTED

{"__type":"NotFoundException","className":"NotFound","code":404,"message":"Unable to find [nonExistentEnvId] in database."}

As you can see, two separate sets of errors are being sent, one in the headers and one in the body. Based on the JSON protocol cloud9 uses, the error code should be only specified in the header (string) whereas the service models their code field as an integer as shown in the body.

I'll raise this internally and see how we can address this.
Thanks again,
Ran~

@RanVaknin RanVaknin added p1 This is a high priority issue queued This issues is on the AWS team's backlog and removed needs-triage This issue or PR still needs to be triaged. labels Feb 6, 2024
@lucix-aws
Copy link
Contributor

lucix-aws commented Feb 7, 2024

The root cause here is that we're making the incorrect assumption that code is a special field in awsjson errors meant to hold the modeled error's name. This is true for __type but the former can technically be modeled as one of the members on the error as well. We're not accounting for that, which we'll need to fix.

@lucix-aws lucix-aws removed the queued This issues is on the AWS team's backlog label Feb 12, 2024
@lucix-aws lucix-aws assigned lucix-aws and unassigned RanVaknin Feb 12, 2024
Copy link

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

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. p1 This is a high priority issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants