I'm testing out using the cli aws cloudformation deploy
command. Each time I run it, though, I'm getting the output:
Unable to parse response (no element found: line 1, column 0), invalid XML received:
b''
I've verified that the updated template runs correctly in the web console and that other cloudformation commands run correctly. I'm running aws-cli version 1.11.36.
Are you able to successfully use any cloudformation deploy commands with any other templates and the problem is related to a single template or does this occur with any cloudformation templates?
@dstufft I just tested with a really simple case where it was only creating a bucket, and it worked fine.
@commondream Can you post your debug logs from this command? You can do so by appending --debug
to the command you ran. It will give us a lot more information on what may be going on.
Here you go. I just grabbed the debug output after the template output since the debug output includes our template and other details of our stack.
2017-01-19 14:39:52,495 - MainThread - botocore.endpoint - DEBUG - Sending http request: <PreparedRequest [POST]>
2017-01-19 14:39:52,592 - MainThread - botocore.vendored.requests.packages.urllib3.connectionpool - DEBUG - "POST / HTTP/1.1"
413 None
2017-01-19 14:39:52,594 - MainThread - botocore.parsers - DEBUG - Response headers: {'transfer-encoding': 'chunked', 'date': '
Thu, 19 Jan 2017 14:39:50 GMT', 'connection': 'close'}
2017-01-19 14:39:52,595 - MainThread - botocore.parsers - DEBUG - Response body:
b''
2017-01-19 14:39:52,595 - MainThread - awscli.customizations.cloudformation.deployer - DEBUG - Unable to create changeset
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 385, in _parse_xml_string_to_dom
root = parser.close()
File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/awscli/customizations/cloudformation/deployer.py", line 102, in create_changeset
Description=description
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 253, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 530, in _make_api_call
operation_model, request_dict)
File "/usr/lib/python3.6/site-packages/botocore/endpoint.py", line 141, in make_request
return self._send_request(request_dict, operation_model)
File "/usr/lib/python3.6/site-packages/botocore/endpoint.py", line 168, in _send_request
request, operation_model, attempts)
File "/usr/lib/python3.6/site-packages/botocore/endpoint.py", line 233, in _get_response
response_dict, operation_model.output_shape)
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 209, in parse
parsed = self._do_error_parse(response, shape)
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 437, in _do_error_parse
root = self._parse_xml_string_to_dom(xml_contents)
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 389, in _parse_xml_string_to_dom
"invalid XML received:\n%s" % (e, xml_string))
botocore.parsers.ResponseParserError: Unable to parse response (no element found: line 1, column 0), invalid XML received:
b''
2017-01-19 14:39:52,596 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 385, in _parse_xml_string_to_dom
root = parser.close()
File "<string>", line None
xml.etree.ElementTree.ParseError: no element found: line 1, column 0
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/awscli/clidriver.py", line 197, in main
return command_table[parsed_args.command](remaining, parsed_args)
File "/usr/lib/python3.6/site-packages/awscli/clidriver.py", line 333, in __call__
return command_table[parsed_args.operation](remaining, parsed_globals)
File "/usr/lib/python3.6/site-packages/awscli/customizations/commands.py", line 187, in __call__
return self._run_main(parsed_args, parsed_globals)
File "/usr/lib/python3.6/site-packages/awscli/customizations/cloudformation/deploy.py", line 160, in _run_main
parsed_args.execute_changeset)
File "/usr/lib/python3.6/site-packages/awscli/customizations/cloudformation/deploy.py", line 168, in deploy
capabilities=capabilities)
File "/usr/lib/python3.6/site-packages/awscli/customizations/cloudformation/deployer.py", line 178, in create_and_wait_for_changeset
stack_name, cfn_template, parameter_values, capabilities)
File "/usr/lib/python3.6/site-packages/awscli/customizations/cloudformation/deployer.py", line 107, in create_changeset
raise ex
File "/usr/lib/python3.6/site-packages/awscli/customizations/cloudformation/deployer.py", line 102, in create_changeset
Description=description
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 253, in _api_call
return self._make_api_call(operation_name, kwargs)
File "/usr/lib/python3.6/site-packages/botocore/client.py", line 530, in _make_api_call
operation_model, request_dict)
File "/usr/lib/python3.6/site-packages/botocore/endpoint.py", line 141, in make_request
return self._send_request(request_dict, operation_model)
File "/usr/lib/python3.6/site-packages/botocore/endpoint.py", line 168, in _send_request
request, operation_model, attempts)
File "/usr/lib/python3.6/site-packages/botocore/endpoint.py", line 233, in _get_response
response_dict, operation_model.output_shape)
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 209, in parse
parsed = self._do_error_parse(response, shape)
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 437, in _do_error_parse
root = self._parse_xml_string_to_dom(xml_contents)
File "/usr/lib/python3.6/site-packages/botocore/parsers.py", line 389, in _parse_xml_string_to_dom
"invalid XML received:\n%s" % (e, xml_string))
botocore.parsers.ResponseParserError: Unable to parse response (no element found: line 1, column 0), invalid XML received:
b''
2017-01-19 14:39:52,597 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255
Unable to parse response (no element found: line 1, column 0), invalid XML received:
b''
@commondream
Interesting. Based on the debug logs, you are getting a 413 error code. Indicating the request is too large. Based on the cloudformation CreateChangeSet documentation, the maximum size of the template can only be 51,200 bytes.
Do you happen to know how large the template is you are sending over?
Ah, that makes sense. Our templates a good bit larger than that. I was assuming deploy used S3. Would it be possible to add a --template-url param as well to cover uploading to S3 first?
I think that makes sense. @sanathkr Do you have any opinions on adding a --template-url
to the deploy
command?
@commondream in the mean time, you should be able to get the same functionality in the deploy
command using the create-change-set
command. The deploy
command primarily uses that command with some additional logic such as waiting for the changeset to complete.
We don't yet have plans to support --template-url. But I would be open to a pull request. deploy
tries to read parameters from the template and merge with override values specified by the user. To implement --template-url, deploy would have to download the template from S3 first.
Meanwhile, you can use create-change-set
followed by execute-change-set
to simulate the deploy command or call update-stack
directly.
Good Morning!
We're closing this issue here on GitHub, as part of our migration to UserVoice for feature requests involving the AWS CLI.
This will let us get the most important features to you, by making it easier to search for and show support for the features you care the most about, without diluting the conversation with bug reports.
As a quick UserVoice primer (if not already familiar): after an idea is posted, people can vote on the ideas, and the product team will be responding directly to the most popular suggestions.
We鈥檝e imported existing feature requests from GitHub - Search for this issue there!
And don't worry, this issue will still exist on GitHub for posterity's sake. As it鈥檚 a text-only import of the original post into UserVoice, we鈥檒l still be keeping in mind the comments and discussion that already exist here on the GitHub issue.
GitHub will remain the channel for reporting bugs.
Once again, this issue can now be found by searching for the title on: https://aws.uservoice.com/forums/598381-aws-command-line-interface
-The AWS SDKs & Tools Team
Based on community feedback, we have decided to return feature requests to GitHub issues.
aws cloudformation validate-template
also surfaces this error message when using --template-body
with a template large enough that --template-url
is needed.
Is it possible to surface a more informative error message?
I observed similar one with create-stack-set
readonly description='https://docs.aws.amazon.com/securityhub/latest/userguide/securityhub-cis-controls.html#cis-1.1-remediation'
aws cloudformation create-stack-set \
--description "$description" \
--template-body "file://$stackTemplate" \
(....other options)
Unable to parse response (no element found: line 1, column 0), invalid XML received:
b''
The cli did work with recomposed $description
below instead of previous url
readonly description='cis1.1'
Size of $stackTemplate
was 2.5K, never modified for stacksets
Most helpful comment
aws cloudformation validate-template
also surfaces this error message when using--template-body
with a template large enough that--template-url
is needed.Is it possible to surface a more informative error message?