Closed SirRawlins closed 5 years ago
Can you provide the http_wire_trace
output (anonymizing specific values like the distribution is fine and even encouraged)? It's hard to tell from this if it's the SDK not properly marshalling the request, or if this is a quirk on the service side.
@awood45 sure thing Alex. Here's the http_wire_trace
generated from the code example.
opening connection to cloudfront.amazonaws.com:443... opened starting SSL for cloudfront.amazonaws.com:443... SSL established <- "PUT /2018-11-05/distribution/XXX/config HTTP/1.1\r\nContent-Type: \r\nAccept-Encoding: \r\nUser-Agent: aws-sdk-ruby3/3.44.2 ruby/2.5.1 x86_64-darwin15 aws-sdk-cloudfront/1.11.0\r\nIf-Match: E25PI0SI26B0B0\r\nHost: cloudfront.amazonaws.com\r\nX-Amz-Date: 20190110T105559Z\r\nX-Amz-Content-Sha256: 759e108068b7c2c3eb552f3149b7ff1a7d87248e3339449dfacf3d88a5f586b4\r\nAuthorization: AWS4-HMAC-SHA256 Credential=XXX SignedHeaders=host;if-match;x-amz-content-sha256;x-amz-date, Signature=c6db1d97c2e9c97d1223bd58045f54ca8fd137a7e522bef6fc867ec8cc0d7a9d\r\nContent-Length: 3224\r\nAccept: /\r\n\r\n" -> "HTTP/1.1 400 Bad Request\r\n" -> "x-amzn-RequestId: 506c5e55-14c6-11e9-89dc-75337560d9a2\r\n" -> "Content-Type: text/xml\r\n" -> "Content-Length: 283\r\n" -> "Date: Thu, 10 Jan 2019 10:55:59 GMT\r\n" -> "Connection: close\r\n" -> "\r\n" reading 283 bytes... -> "" -> "<?xml version=\"1.0\"?>\n<ErrorResponse xmlns=\"http://cloudfront.amazonaws.com/doc/2018-11-05/\">
Sender MalformedInput
Unexpected list element termination 506c5e55-14c6-11e9-89dc-75337560d9a2 " read 283 bytes Conn close Traceback (most recent call last): 16: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:inblock in require_with_bootsnap_lfi' 15: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in
require' 14: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/railties-4.2.11/lib/rails/commands.rb:17:in<main>' 13: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/railties-4.2.11/lib/rails/commands/commands_tasks.rb:39:in
run_command!' 12: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/railties-4.2.11/lib/rails/commands/commands_tasks.rb:68:inconsole' 11: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/railties-4.2.11/lib/rails/commands/console.rb:9:in
start' 10: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/railties-4.2.11/lib/rails/commands/console.rb:110:instart' 9: from (irb):7 8: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-cloudfront-1.11.0/lib/aws-sdk-cloudfront/client.rb:3712:in
update_distribution' 7: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-core-3.44.2/lib/seahorse/client/request.rb:70:insend_request' 6: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-core-3.44.2/lib/seahorse/client/plugins/response_target.rb:23:in
call' 5: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-core-3.44.2/lib/aws-sdk-core/plugins/response_paging.rb:10:incall' 4: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-core-3.44.2/lib/aws-sdk-core/plugins/param_converter.rb:24:in
call' 3: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-core-3.44.2/lib/aws-sdk-core/plugins/idempotency_token.rb:17:incall' 2: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-core-3.44.2/lib/aws-sdk-core/plugins/jsonvalue_converter.rb:20:in
call' 1: from /Users/robertrawlins/.rvm/gems/ruby-2.5.1/gems/aws-sdk-core-3.44.2/lib/seahorse/client/plugins/raise_response_errors.rb:15:in `call' Aws::CloudFront::Errors::MalformedInput (Unexpected list element termination)
Let me know if there's anything else I can do to help narrow down what's going on.
@SirRawlins
This is caused by the CloudFront API returning a self-closed tag in the get_distribution_config response:
<OriginGroups>
<Quantity>0</Quantity>
<Items/>
</OriginGroups>
That output is an invalid input for the the update_distribution_config operation. I've opened a request for the CloudFront Service Team to investigate.
Excellent stuff. Thanks so much. 👍
On Mon, 14 Jan 2019, 17:38 Chase Coalwell <notifications@github.com wrote:
@SirRawlins https://github.com/SirRawlins
This is caused by the CloudFront API returning a self-closed tag in the get_distribution_config response:
0 That output is an invalid input for the the update_distribution_config operation. I've opened a request for the CloudFront Service Team to investigate.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/aws/aws-sdk-ruby/issues/1954#issuecomment-454093350, or mute the thread https://github.com/notifications/unsubscribe-auth/AAtiKxrfTT_4ymE0x_wwlrie7nmaegxYks5vDMCOgaJpZM4Z1JJp .
This appears to be fixed.
This seems to be a regression (issues #1067, #774 and #99), but I'm getting the same error with aws-sdk-cloudfront v1.11.0 (with Ruby 2.5.1).
I've only just started working with the SDK so can't be sure when this was introduced.
Looking at the previous issues, and conversations on StackOverflow it seems to be a recurring issue, whereby the SDK doesn't like
{ :quantity => 0, :items => [] }
in the payload. If quantity is 0, the items key should not be included.Failing test case:
Work Around:
I'm currently able to work around this error by deleting the the
[:origin_groups][:items]
key from the distribution_config payload, who's value is currently an empty array.