Redeploy using chalice-local deploy fails

Open
#11 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
python
Domain
api

Research direction

Start with the reported chalice config and reproduce a first deployment followed by a redeploy against LocalStack. Investigate the minimumCompressionSize value and the explicitly configured minimum_compression_size setting; done means redeployment succeeds without deleting the existing app.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Python
Stars
21
Forks
3
PR merge metrics
No merged PRs in 30d

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from localstack/chalice-local

All issues in localstack/chalice-local

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.