1

Updating AWS Lambda code from the command line. Using command

aws lambda update-function-code --function-name LAMBDA_FUNCTION_NAME \
--zip-file fileb://lambdaFunc.zip --publish

Returns

Connection was closed before we received a valid response from endpoint URL: "https://lambda.us-east-2.amazonaws.com/XX/code"

It used to work, and other aws lambda commands still work fine.

1 Answer 1

2

The problem is a networking timeout.

Fix: add --cli-connect-timeout 6000 to the command line. Eg

aws lambda update-function-code --function-name LAMBDA_FUNCTION_NAME \
--zip-file fileb://lambdaFunc.zip --cli-connect-timeout 6000 --publish 

Also, check the size of your zip file: it can't be larger than 50MB. See the Deployment Package max size

More info from an AWS GitHub issue.

Please upvote / comment on the feature request to make --cli-connect-timeout 6000 be the default: See the GitHub feature request

From CLI help/man page for --cli-connect-timeout (int):

The maximum socket connect time in seconds. If the value is set to 0, the socket connect will be blocking and not timeout. The default value is 60 seconds.

2
  • How did you arrive at the number 6,000 (as opposed to 600 or 3,000 or any other number)? And is this milliseconds or seconds? What is the current default?
    – 2540625
    Jul 5, 2021 at 23:32
  • (If the answer was useful to you, please upvote it. Thank you.) The cli-connect-timeout setting is in seconds. So 6000 is 100 minutes. You can use whatever value works for you. I don't know the default.
    – Larry K
    Jul 7, 2021 at 5:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .