chilts / nice-route53

A nicer API to Amazon's Route53.
Apache License 2.0
37 stars 20 forks source link

setRecord error #12

Closed MikeBild closed 8 years ago

MikeBild commented 8 years ago

Sometimes the following error is reported:

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.

Any suggestions?

leorossi commented 8 years ago

Hi,

I believe this error lays into these lines https://github.com/chilts/nice-route53/blob/master/nice-route53.js#L389-L397 Can you reproduce the error? Having the opts argument, that generate the error, printed here would help us to understand.

MikeBild commented 8 years ago

Hi,

thanks. Ohh yes, it could be that my opts.values is an empty Array i.e. opts.values: []. I try to reproduce that.

MikeBild commented 8 years ago

Hi,

solved. Don't set an empty Array to prevent the empty XML node. Thanks.

leorossi commented 8 years ago

Good to hear then! 👍

chilts commented 8 years ago

Cool, glad you got it sorted. It's interesting but from the original message it says One of '{"https://route53.amazonaws.com/doc/2013-04-01/":ResourceRecord}' is expected., which pretty much tells us what the error is, however, that's on the understanding that our eyes parse Amazon's error messages correctly.

I was wondering whether we needed to add a check for this, but then, when I did AwsSum, I tried to do this and failed mainly because you've then got to keep all the checks complete, whereas Amazon's checks should always be correct. :)

So yeah, even though Amazon's error messages aren't always obvious, I think it's definitely best that we don't check for problems like this and just let Amazon sort it out. The hardest part then is figuring out why the request failed - which is what you struck upon.

Anyway, I don't have anything real to add to this bug except a brain dump of the above. If anyone else has any thoughts on this matter, we might as well stick them here if we do want to do something other than what we are currently doing.

Thanks everyone.