Chalice: Slow deploy

Created on 7 Mar 2019  路  11Comments  路  Source: aws/chalice

My lambda is around 10mb so I expect it shouldn't take long with a 10mbit/s connection to upload, but I always get a timeout (botocore.exceptions.ConnectionClosedError: Connection was closed before we received a valid response from endpoint URL: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions") with the default deploy setting. Not sure how you are doing things, but it's not very efficient...
I raised the timeout using --connection-timeout parameter to 5 minutes and it worked though.

closing-soon-if-no-response

Most helpful comment

I had the same problem while deploying dev stage, this command worked for me. Thank you @Sytten
chalice deploy --stage dev --connection-timeout 360

All 11 comments

Chalice deployments should be relatively fast and should not have to worry about timeout. Could you provide the sample snippet of the application you are trying to deploy with its requirements? Also could you provide debug logs from running chalice deploy? You can get them by running chalice --debug deploy.

My code is not open source, but here is my requirements:

psycopg2==2.7.7
boto3==1.9.89
SQLAlchemy==1.2.17

I will do a deploy tomorrow.

same issue here.
Hello world example works just fine.

When I try something fancier, with my requirements.txt being just:

pandas==0.24.2
pymongo==3.8.0

it gives me the same error

I think it will depend on your connection to AWS. Can you confirm that setting the connection timeout to a higher value fixes the issue for you?

I tried the same dependencies (admittedly I have a fast connection to AWS) which seems to work:

$ cat requirements.txt
pandas==0.24.2
pymongo==3.8.0
$ chalice deploy
Creating deployment package.
Creating IAM role: testjsonpath-dev
Creating lambda function: testjsonpath-dev
Creating Rest API
Resources deployed:
  - Lambda ARN: arn:aws:lambda:us-west-2:288942387673:function:testjsonpath-dev
  - Rest API URL: https://<rest-api-id>.execute-api.us-west-2.amazonaws.com/api/

If bumping the connection timeout works, perhaps we should add that as an option in your config.json so you don't have to specify it every time.

For me it worked, but it seemed suspicious that is it so slow. A config would be nice.

Slow here as well, and getting the "Connection was closed..." error too.

Yes. Things I could easily deploy very quickly before, now timeout or take a very long time. This doesn't appear to be a bandwidth problem, as I've tried on various networks and regions. I've tried commenting out various functions, removed various packages. I've even tried simple 'Hello World' applications. This just started happening for us in the last couple of days.

I find if I comment out a couple of routes/schedules/etc., it is more apt to work. Then I try reintroduce them one at a time and it'll sometimes work. The more the more routes, the more apt it is to fail.

I had the same problem while deploying dev stage, this command worked for me. Thank you @Sytten
chalice deploy --stage dev --connection-timeout 360

I'll add something to the docs about raising the connection timeout, but in general, the more dependencies you pull in the longer the deployment will take. There's some ongoing work to improve that by using layers.

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

+1 throwing a short note in the docs would be very useful. Agreed minimizing dependencies is ideal but this is a handy option to know about if you're in a situation where you do have a few large ones :slightly_smiling_face:

Was this page helpful?
0 / 5 - 0 ratings