localstack / chalice-local

Small wrapper script to use AWS Chalice with LocalStack
Apache License 2.0
21 stars 3 forks source link

Redeploy using chalice-local deploy fails #11

Open emilt27 opened 1 year ago

emilt27 commented 1 year ago

Hello everyone!

Here is my chalice config:

{
  "version": "2.0",
  "app_name": "myapp",
  "stages": {
    "dev": {
      "api_gateway_stage": "api"
    }
  }
}

The first deployment to localstack works properly. But if I try to redeploy, without deleting previously deployed app, I'm getting:

2023-07-23T12:51:31.918 ERROR --- [   asgi_gw_0] l.aws.handlers.logging     : exception during call chain
Traceback (most recent call last):
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/chain.py", line 90, in handle
    handler(self, self.context, response)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/handlers/service.py", line 123, in __call__
    handler(chain, context, response)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/handlers/service.py", line 93, in __call__
    skeleton_response = self.skeleton.invoke(context)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/skeleton.py", line 154, in invoke
    return self.dispatch_request(context, instance)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/skeleton.py", line 166, in dispatch_request
    result = handler(context, instance) or {}
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/forwarder.py", line 60, in _call
    return handler(context, req)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/skeleton.py", line 118, in __call__
    return self.fn(*args, **kwargs)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/apigateway/provider.py", line 201, in get_rest_api
    rest_api: RestApi = call_moto(context)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/services/moto.py", line 47, in call_moto
    return dispatch_to_backend(context, dispatch_to_moto, include_response_metadata)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/forwarder.py", line 121, in dispatch_to_backend
    parsed_response = parse_response(context.operation, http_response, include_response_metadata)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/localstack/aws/client.py", line 173, in parse_response
    parsed_response = parser.parse(response_dict, operation.output_shape)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 252, in parse
    parsed = self._do_parse(response, shape)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 881, in _do_parse
    self._add_modeled_parse(response, shape, final_parsed)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 891, in _add_modeled_parse
    self._parse_payload(response, shape, member_shapes, final_parsed)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 933, in _parse_payload
    body_parsed = self._parse_shape(shape, original_parsed)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 332, in _parse_shape
    return handler(shape, node)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 663, in _handle_structure
    final_parsed[member_name] = self._parse_shape(
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 332, in _parse_shape
    return handler(shape, node)
  File "/opt/code/localstack/.venv/lib/python3.10/site-packages/botocore/parsers.py", line 1020, in _handle_integer
    return int(value)
ValueError: invalid literal for int() with base 10: ''
2023-07-23T12:51:31.921  INFO --- [   asgi_gw_0] localstack.request.aws     : AWS apigateway.GetRestApi => 500 (InternalError)

The chalice app is default generated by chalice-local new-project -t rest-api myapp. Any idea what is wrong?

UPD: By debugging locally I've found that it fails on trying to get 'minimumCompressionSize':

image image

UPD 2: I was able to solve it by explicitly specifying the minimum_compression_size (https://aws.github.io/chalice/topics/configfile.html#minimum-compression-size) in my chalice config.

lakkeger commented 11 months ago

Hi @emilt27, I've looked into the issue and it seems it's related to our AWS API Gateway implementation, please follow the state of the issue on the refered ticket.