localstack / aws-sam-cli-local

Simple wrapper around AWS SAM CLI for use with LocalStack
Apache License 2.0
48 stars 8 forks source link

Parsing crash on "Looking for resources needed for deployment" #4

Closed sohah closed 2 years ago

sohah commented 2 years ago

Hi,

I am running into a crash on parsing when creating the resources. I was trying to deploy this repo after using "samlocal build" on it. Looks like this error is related only to the wrapper as I could execute "sam deploy" to trigger the original aws version without any errors.

Below is the stack trace. I am using python 3.8.

Looking for resources needed for deployment:
Traceback (most recent call last):
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/parsers.py", line 486, in _parse_xml_string_to_dom
    parser.feed(xml_string)
xml.etree.ElementTree.ParseError: not well-formed (invalid token): line 1, column 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/sohahussein/anaconda3/bin/samlocal", line 41, in <module>
    main.cli()
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/lib/cli_validation/image_repository_validation.py", line 92, in wrapped
    return func(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/click/decorators.py", line 73, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/lib/telemetry/metric.py", line 166, in wrapped
    raise exception  # pylint: disable=raising-bad-type
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/lib/telemetry/metric.py", line 124, in wrapped
    return_value = func(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/lib/utils/version_checker.py", line 41, in wrapped
    actual_result = func(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/cli/main.py", line 87, in wrapper
    return func(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/commands/_utils/cdk_support_decorators.py", line 38, in wrapped
    return func(*args, **kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/commands/deploy/command.py", line 165, in cli
    do_cli(
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/commands/deploy/command.py", line 255, in do_cli
    guided_context.run()
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/commands/deploy/guided_context.py", line 559, in run
    self.guided_prompts(_parameter_override_keys)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/commands/deploy/guided_context.py", line 181, in guided_prompts
    s3_bucket = manage_stack(profile=self.profile, region=region)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/lib/bootstrap/bootstrap.py", line 22, in manage_stack
    outputs: StackOutput = manage_cloudformation_stack(
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/lib/utils/managed_cloudformation_stack.py", line 86, in manage_stack
    return _create_or_get_stack(cloudformation_client, stack_name, template_body, parameter_overrides)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/samcli/lib/utils/managed_cloudformation_stack.py", line 97, in _create_or_get_stack
    ds_resp = cloudformation_client.describe_stacks(StackName=stack_name)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/client.py", line 395, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/client.py", line 711, in _make_api_call
    http, parsed_response = self._make_request(
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/client.py", line 731, in _make_request
    return self._endpoint.make_request(operation_model, request_dict)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/endpoint.py", line 107, in make_request
    return self._send_request(request_dict, operation_model)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/endpoint.py", line 181, in _send_request
    success_response, exception = self._get_response(
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/endpoint.py", line 215, in _get_response
    success_response, exception = self._do_get_response(
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/endpoint.py", line 269, in _do_get_response
    parsed_response = parser.parse(
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/parsers.py", line 243, in parse
    parsed = self._do_error_parse(response, shape)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/parsers.py", line 540, in _do_error_parse
    root = self._parse_xml_string_to_dom(xml_contents)
  File "/Users/sohahussein/anaconda3/lib/python3.8/site-packages/botocore/parsers.py", line 489, in _parse_xml_string_to_dom
    raise ResponseParserError(
botocore.parsers.ResponseParserError: Unable to parse response (not well-formed (invalid token): line 1, column 0), invalid XML received. Further retries may succeed:
b'{}'
whummer commented 2 years ago

Thanks for reporting @sohah . Can you please share the relevant snippets of your SAM template here, as well as the detailed logs from the LocalStack container (with DEBUG=1 enabled)? Thanks!

sohah commented 2 years ago

Unfortunately, I do not have access to the environment that I used when this problem occurred. I am closing this issue as I am unable to reproduce it.