Describe the bug
I'm trying to delete a route53 record, for the same, I am first querying the records using listResourceRecordSets Operator

Now that I get the ResourceRecordSet from this response, I do basic validations and now try to call delete on the same using this resourceRecordSet as the input like the image below.

So technically everything should be working just fine, but then I'm faced with an error that says like the below
InvalidInput: Invalid XML ; cvc-complex-type.2.4.b: The content of element 'ResourceRecords' is not complete. One of '{"https://route53.amazonaws.com/doc/2013-04-01/":ResourceRecord}' is expected.
at Request.extractError (/Users/kirananto/Projects/express-docker/node_modules/aws-sdk/lib/protocol/rest_xml.js:53:29)
at Request.callListeners (/Users/kirananto/Projects/express-docker/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
I was stuck with this issue for around a day, unable to find any solutions. Tried a couple of different changes, but since it's straightforward there was nothing to try out. But later came to know that the response from the first list query had resourceRecords as [] instead of undefined, which was the cause of all the issue
Note: If you're creating an alias resource record set, omit ResourceRecords.
So naturally, since I'm expecting only AliasTargets I changed my code to this

And everything started working, So shouldn't this be very natural, as in when we call list, the response that we get, we should be able to pass the same object without modification to other APIs which has the input as those. Also if that's not the case, shouldn't that be documented somewhere?
I'm raising this bug so that someone facing the same issue could refer to this for the fix.
FYI: This bug is not visible in other clients, I tried with the python client and it just works fine. So I guess it's just very specific to js client.
Is the issue in the browser/Node.js?
Node.js
If on Node.js, are you running this on AWS Lambda?
No
Details of the browser/Node.js version
v13.14.0
SDK version number
2.737.0
To Reproduce (observed behavior)
Use the code as in the above description, You'll come across the same issue.
Expected behavior
The value of resourceRecords should be undefined, if not handled properly by the delete. Either it has to be handled by the delete Functionality or it has to be sent as undefined in the list output.
Screenshots
Not applicable, screenshots posted in the above description
Additional context
N/A
@kirananto Thank-you for raising it, I will take a look at it if the second request where you get resourceRecords as [] whether it is serialized like that from the SDK or the service team and go from there.
Ran into the same issue. Definitely a complication of mild annoyance :).
Worked around via
if (recordset.ResourceRecords?.length == 0) {
delete recordset.ResourceRecords;
}
before constructing the ChangeBatch.
Yep that works @jgehrcke
Ideally it user shouldn't be annoyed by this, we expect all sdks to work similarly
@ajredniwja Hi Ajwinder, Did you get a chance to look into the issue ?
Had this same issue. Thanks so much @jgehrcke. Had me a good 2 days on this.
Most helpful comment
Ran into the same issue. Definitely a complication of mild annoyance :).
Worked around via
before constructing the ChangeBatch.