question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Chalice deploy always timeout ( due to size..? )

See original GitHub issue

Hello,

I have two big dependencies ( ffmpeg and Psycopg2 ) and whenever I try to run chalice deploy it gives a timeout after 40 minutes ( which is weird as well).

Any idea if I could zip it locally (save locally the deployment package) and then upload it manually? I guess there must be a single command line way to do this. And do you know where it saves once uploaded so that I could replace it ( i guess it goes somewhere in S3 but I couldn’t find the path)?

Thank you in advance, Michael.

log

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/2.7/bin/chalice", line 9, in <module>
    load_entry_point('chalice==0.6.0', 'console_scripts', 'chalice')()
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chalice/cli/__init__.py", line 298, in main
    return cli(obj={})
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chalice/cli/__init__.py", line 177, in deploy
    d.deploy(config)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chalice/deployer.py", line 212, in deploy
    self._lambda_deploy.deploy(config)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chalice/deployer.py", line 599, in deploy
    function_arn = self._first_time_lambda_create(config)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chalice/deployer.py", line 661, in _first_time_lambda_create
    app_name, role_arn, zip_contents)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/chalice/awsclient.py", line 67, in create_function
    response = client.create_function(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/client.py", line 253, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/client.py", line 544, in _make_api_call
    operation_model, request_dict)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/endpoint.py", line 141, in make_request
    return self._send_request(request_dict, operation_model)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/endpoint.py", line 170, in _send_request
    success_response, exception):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/endpoint.py", line 249, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/hooks.py", line 227, in emit
    return self._emit(event_name, kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/hooks.py", line 210, in _emit
    response = handler(**kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/retryhandler.py", line 251, in __call__
    caught_exception)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/retryhandler.py", line 277, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/retryhandler.py", line 317, in __call__
    caught_exception)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/botocore/retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
botocore.vendored.requests.exceptions.ConnectionError: ('Connection aborted.', error(32, 'Broken pipe'))

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
stealthycoincommented, May 31, 2017

How are you bundling it right now? chalice deploy takes your requirements.txt and installs them to a fresh virtual environment and then bundles that environment up with the contents of the vendor folder. The deployments you make are archived in .chalice/deployments/<hash_of_package>.zip. You can take a look at that to see how large the package you are currently trying to deploy is.

For more control over the release process you can use the chalice package command instead of , chalice deploy. This will give your more control, but is more involved and requires a s3 bucket to temporarily store the lambda bundle in.

For example: chalice package pkg will create a pkg folder with the contents sam.json and deployment.zip. You can crack this zipfile open and make sure everything is as you expect, or remove things, strip binary files etc…

When you are ready to deploy the package you can use the awscli to produce a cloudformation template from the package like so: aws cloudformation package --template-file pkg/sam.json --s3-bucket <bucket-name> --output-template-file packaged.yaml

That will upload your bundle to the specified s3 bucket, and take in that sam.json file and rewrite it to a packaged.yaml file that can be used with cloudformation deploy.

So the final step would be: aws cloudformation deploy --template-file packaged.yaml --stack-name <some-stack-name-here>

Getting the endpoint URL from command line: aws cloudformation describe-stacks --stack-name <some-stack-name-here> --output text --query "Stacks[].Outputs[?OutputKey=='EndpointURL'][] | [0].OutputValue"

Or of course you can check the console.

Hopefully some of this helps.

0reactions
nicolasfguillaumecommented, May 2, 2019

On the final step, I faced the following error: Failed to create the changeset: Waiter ChangeSetCreateComplete failed: Waiter encountered a terminal failure state Status: FAILED. Reason: Requires capabilities : [CAPABILITY_IAM]
It can be solved by adding the following flag to the command: --capabilities CAPABILITY_IAM The final step becomes:
aws cloudformation deploy --template-file packaged.yaml --stack-name <some-stack-name-here> --capabilities CAPABILITY_IAM Thanks @stealthycoin!!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using AWS Chalice to deploy with large dependencies results ...
When I has issues with the full deployment, I decided to try increasing the size by adding dependencies. I have been successful in...
Read more >
awslabs/chalice - Gitter
hi, i created a chalice app and deployed to stages: dev, then prod. however, after deploying the prod stage, the 'prod' stage in...
Read more >
Chalice - Open Source at AWS
batch_size – The maximum number of messages to retrieve when polling for SQS messages. The event parameter can have multiple SQS messages associated...
Read more >
Use AWS Chalice to develop and deploy Lambda function
Make sure to run this command from the lambda folder. If your deployment times out due to your connection, please add --connection-timeout 360...
Read more >
3 Major Ways To Improve AWS Lambda Performance - Lumigo
Module initialization is always run at full power ... So, deployment size does impact cold start, but the impact is somewhat minimal if...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found