awslabs / aws-sdk-kotlin

Multiplatform AWS SDK for Kotlin
Apache License 2.0
416 stars 49 forks source link

InvalidChangeBatch custom error handling no longer works #1433

Closed ewanmellor closed 3 weeks ago

ewanmellor commented 1 month ago

Describe the bug

Reading #242 , the error response from Route 53 used to use a custom InvalidChangeBatch element. That no longer seems to be the case: my current error response looks like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<ErrorResponse xmlns="https://route53.amazonaws.com/doc/2013-04-01/">
    <Error>
        <Type>Sender</Type>
        <Code>InvalidChangeBatch</Code>
        <Message>[Tried to delete resource record set [name='foo.', type='CNAME'] but it was not found]</Message>
    </Error>
    <RequestId>...</RequestId>
</ErrorResponse>

This fails to parse using the custom code here:

https://github.com/awslabs/aws-sdk-kotlin/blob/acccef5bcd6905c51751291fa94fdbcfd8029b98/services/route53/common/src/aws/sdk/kotlin/services/route53/internal/ChangeResourceRecordSetsUnmarshalling.kt#L14

This means that the error message is lost to the caller.

Regression Issue

Expected behavior

The error message from the response should be parsed into InvalidChangeBatch.message.

Current behavior

The error message is not parsed.

Steps to Reproduce

Call Route53Client.changeResourceRecordSets with invalid parameters.

Possible Solution

One change would be to extend this custom parsing to handle the <Error> tag and parse appropriately. Alternatively if someone from AWS can confirm that this endpoint has switched to the "standard" error response then maybe all this custom code can go away.

Context

Trying to parse errors from Route 53.

AWS SDK for Kotlin version

1.1.7

Platform (JVM/JS/Native)

Kotlin JVM

Operating system and version

macOS 15

lauzadis commented 1 month ago

Hey, thanks for the report, I've been able to replicate it. After disabling our customization I'm able to see the message in the exception, checking to see if that's the "right" fix...

ianbotsf commented 1 month ago

A fix for this was release in SDK version 1.3.52 on 10/11/2024. Can you verify whether the problem is resolved with the latest SDK version?

ewanmellor commented 1 month ago

I've filed a ticket on our side to verify. It might be a week or two, we have other work in the pipeline.