Aws-cli: 错误:在我们收到来自端点 URL 的有效响应之前,连接已关闭

创建于 2019-01-10  ·  50评论  ·  资料来源: aws/aws-cli

尝试使用 cli 将我的代码上传到 Lambda 时收到上述错误:

aws lambda update-function-code --function-name <api> --zip-file fileb://api.zip

几天前这工作正常,但今天它一直失败。

这是一段调试日志,其中抛出错误:

2019-01-10 15:08:06,708 - MainThread - botocore.hooks - DEBUG - Event request-created.lambda.UpdateFunctionCode: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x000002439C15CE10>>
2019-01-10 15:08:06,708 - MainThread - botocore.hooks - DEBUG - Event choose-signer.lambda.UpdateFunctionCode: calling handler <function set_operation_specific_signer at 0x000002439A2B69D8>
2019-01-10 15:08:06,744 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2019-01-10 15:08:06,744 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
PUT
/2015-03-31/functions/################################/code

host:lambda.us-east-1.amazonaws.com
x-amz-date:20190110T130806Z

host;x-amz-date
33a30325ede6631c605d7dd8fc83cb0200f609b587e0ff6821ae2b88e9d6ffea
2019-01-10 15:08:06,745 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20190110T130806Z
20190110/us-east-1/lambda/aws4_request
003e24e57b3ce08238427bf808241b76bcd70c30b3cafc1bf5e3c18f92a6f8da
2019-01-10 15:08:06,745 - MainThread - botocore.auth - DEBUG - Signature:
###########################################
2019-01-10 15:08:06,746 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=PUT, url=https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/#############################/code, headers={'User-Agent': b'aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7', 'X-Amz-Date': b'20190110T130806Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=############################/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=###################################', 'Content-Length': '15340895'}>
2019-01-10 15:09:08,100 - MainThread - botocore.hooks - DEBUG - Event needs-retry.lambda.UpdateFunctionCode: calling handler <botocore.retryhandler.RetryHandler object at 0x000002439AB59E10>
2019-01-10 15:09:08,101 - MainThread - botocore.retryhandler - DEBUG - retry needed, retryable exception caught: Connection was closed before we received a valid response from endpoint URL: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/##############################/code".
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
socket.timeout: The write operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 242, in send
    decode_content=False,
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\util\retry.py", line 343, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\packages\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 269, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 317, in __call__
    caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 174, in _get_response
    http_response = self._send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 218, in _send
    return self.http_session.send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 273, in send
    endpoint_url=request.url
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/###########################/code".
2019-01-10 15:09:08,128 - MainThread - botocore.retryhandler - DEBUG - Retry needed, action of: 0.23947896318623496
2019-01-10 15:09:08,129 - MainThread - botocore.endpoint - DEBUG - Response received to retry, sleeping for 0.23947896318623496 seconds

它重试了几次,但不断失败。 它最终失败并出现以下错误:

Connection was closed before we received a valid response from endpoint URL: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/##############################/code".

问题是什么?

guidance

最有用的评论

我可能只是很幸运,但在添加以下内容后它对我有用:

--cli-connect-timeout 6000

所有50条评论

我仍然遇到这个问题。 有什么建议?

@moldstadt - 感谢您的联系。 由于此用途按预期工作,文件大小可能已增加并超过Lambda 限制。 如果文件大小大于 50 MB,请告知我们。

另外,感谢您在初始响应中提供调试输出。 似乎只提供了部分调试,我无法确定正在使用的 CLI 版本。 如果文件大小未超过 Lamdba 限制并且此问题继续存在,请提供更多调试输出。

此外,您可以尝试以下操作:

  1. 启用历史记录
  2. 重新运行命令以重现超时。
  3. 运行aws history show以查看是否有任何其他状态代码可以帮助我们更好地理解问题。

@justnance感谢您的反馈。

zip 文件只有 11MB(未压缩为 67MB)。

CLI 版本是 1.16.17。

这是一个更完整的调试日志:

call aws lambda update-function-code --function-name ############################### --zip-file fileb://API.zip --debug
2019-01-11 12:41:02,455 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7
2019-01-11 12:41:02,455 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['lambda', 'update-function-code', '--function-name', '###############################', '--zip-file', 'fileb://API.zip', '--debug']
2019-01-11 12:41:02,457 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function add_scalar_parsers at 0x000002CF1562E7B8>
2019-01-11 12:41:02,457 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,457 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function register_uri_param_handler at 0x000002CF14F877B8>
2019-01-11 12:41:02,458 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,459 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function inject_assume_role_provider_cache at 0x000002CF14FAB730>
2019-01-11 12:41:02,460 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,460 - MainThread - botocore.session - DEBUG - Loading variable credentials_file from defaults.
2019-01-11 12:41:02,460 - MainThread - botocore.session - DEBUG - Loading variable config_file from defaults.
2019-01-11 12:41:02,461 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,461 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_timeout from defaults.
2019-01-11 12:41:02,462 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,462 - MainThread - botocore.session - DEBUG - Loading variable metadata_service_num_attempts from defaults.
2019-01-11 12:41:02,663 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,663 - MainThread - botocore.hooks - DEBUG - Event session-initialized: calling handler <function attach_history_handler at 0x000002CF154D0AE8>
2019-01-11 12:41:02,665 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,665 - MainThread - awscli.customizations.history - DEBUG - Enabling CLI history
2019-01-11 12:41:02,675 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:02,675 - MainThread - botocore.session - DEBUG - Loading variable api_versions from defaults.
2019-01-11 12:41:02,677 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\data\lambda\2015-03-31\service-2.json
2019-01-11 12:41:02,680 - MainThread - botocore.hooks - DEBUG - Event service-data-loaded.lambda: calling handler <function register_retries_for_service at 0x000002CF14E6C1E0>
2019-01-11 12:41:02,681 - MainThread - botocore.handlers - DEBUG - Registering retry handlers for service: lambda
2019-01-11 12:41:02,684 - MainThread - botocore.hooks - DEBUG - Event building-command-table.lambda: calling handler <function add_waiters at 0x000002CF156349D8>
2019-01-11 12:41:02,722 - MainThread - awscli.clidriver - DEBUG - OrderedDict([('function-name', <awscli.arguments.CLIArgument object at 0x000002CF15F5CFD0>), ('zip-file', <awscli.arguments.CLIArgument object at 0x000002CF15F58400>), ('s3-bucket', <awscli.arguments.CLIArgument object at 0x000002CF15F625F8>), ('s3-key', <awscli.arguments.CLIArgument object at 0x000002CF15F620B8>), ('s3-object-version', <awscli.arguments.CLIArgument object at 0x000002CF15F62048>), ('publish', <awscli.arguments.BooleanArgument object at 0x000002CF15F620F0>), ('no-publish', <awscli.arguments.BooleanArgument object at 0x000002CF15F62160>), ('dry-run', <awscli.arguments.BooleanArgument object at 0x000002CF15F62278>), ('no-dry-run', <awscli.arguments.BooleanArgument object at 0x000002CF15F62240>), ('revision-id', <awscli.arguments.CLIArgument object at 0x000002CF15F62358>)])
2019-01-11 12:41:02,723 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lambda.update-function-code: calling handler <function add_streaming_output_arg at 0x000002CF1562ED08>
2019-01-11 12:41:02,724 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lambda.update-function-code: calling handler <function _modify_zipfile_docstring at 0x000002CF14FAB8C8>
2019-01-11 12:41:02,725 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lambda.update-function-code: calling handler <function add_cli_input_json at 0x000002CF14FABD08>
2019-01-11 12:41:02,727 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lambda.update-function-code: calling handler <function unify_paging_params at 0x000002CF15649BF8>
2019-01-11 12:41:02,767 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\data\lambda\2015-03-31\paginators-1.json
2019-01-11 12:41:02,768 - MainThread - botocore.hooks - DEBUG - Event building-argument-table.lambda.update-function-code: calling handler <function add_generate_skeleton at 0x000002CF154C9950>
2019-01-11 12:41:02,773 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.lambda.update-function-code: calling handler <bound method OverrideRequiredArgsArgument.override_required_args of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x000002CF15F624A8>>
2019-01-11 12:41:02,774 - MainThread - botocore.hooks - DEBUG - Event before-building-argument-table-parser.lambda.update-function-code: calling handler <bound method GenerateCliSkeletonArgument.override_required_args of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x000002CF15F623C8>>
2019-01-11 12:41:02,776 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.function-name: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000002CF144BB908>
2019-01-11 12:41:02,777 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.lambda.update-function-code: calling handler <function validate_is_zip_file at 0x000002CF14FAB6A8>
2019-01-11 12:41:02,777 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.lambda.update-function-code: calling handler <awscli.argprocess.ParamShorthandParser object at 0x000002CF151F1BE0>
2019-01-11 12:41:02,778 - MainThread - awscli.arguments - DEBUG - Unpacked value of '###############################' for parameter "function_name": '###############################'
2019-01-11 12:41:02,780 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.zip-file: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000002CF144BB908>
2019-01-11 12:41:02,793 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.lambda.update-function-code: calling handler <function validate_is_zip_file at 0x000002CF14FAB6A8>
2019-01-11 12:41:02,885 - MainThread - botocore.hooks - DEBUG - Event process-cli-arg.lambda.update-function-code: calling handler <awscli.argprocess.ParamShorthandParser object at 0x000002CF151F1BE0>
2019-01-11 12:41:07,698 - MainThread - awscli.arguments - DEBUG - Unpacked value of b'PK\x03\x04\x14\...'
2019-01-11 12:41:53,427 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.s3-bucket: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,427 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.s3-key: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,428 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.s3-object-version: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,431 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.publish: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,432 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.dry-run: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,433 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.revision-id: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,433 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.cli-input-json: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,434 - MainThread - botocore.hooks - DEBUG - Event load-cli-arg.lambda.update-function-code.generate-cli-skeleton: calling handler <awscli.paramfile.URIArgumentHandler object at 0x000001961C94B9E8>
2019-01-11 12:41:53,434 - MainThread - botocore.hooks - DEBUG - Event calling-command.lambda.update-function-code: calling handler <bound method CliInputJSONArgument.add_to_call_parameters of <awscli.customizations.cliinputjson.CliInputJSONArgument object at 0x000001961E3E24A8>>
2019-01-11 12:41:53,434 - MainThread - botocore.hooks - DEBUG - Event calling-command.lambda.update-function-code: calling handler <bound method GenerateCliSkeletonArgument.generate_json_skeleton of <awscli.customizations.generatecliskeleton.GenerateCliSkeletonArgument object at 0x000001961E3E23C8>>
2019-01-11 12:41:53,434 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:53,434 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:53,435 - MainThread - botocore.session - DEBUG - Loading variable region from config file with value 'us-east-1'.
2019-01-11 12:41:53,435 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:53,435 - MainThread - botocore.session - DEBUG - Loading variable ca_bundle from defaults.
2019-01-11 12:41:53,435 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:53,435 - MainThread - botocore.session - DEBUG - Loading variable api_versions from defaults.
2019-01-11 12:41:53,435 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: env
2019-01-11 12:41:53,436 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: assume-role
2019-01-11 12:41:53,436 - MainThread - botocore.credentials - DEBUG - Looking for credentials via: shared-credentials-file
2019-01-11 12:41:53,437 - MainThread - botocore.credentials - INFO - Found credentials in shared credentials file: ~/.aws/credentials
2019-01-11 12:41:53,438 - MainThread - botocore.loaders - DEBUG - Loading JSON file: C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\data\endpoints.json
2019-01-11 12:41:53,447 - MainThread - botocore.session - DEBUG - Loading variable profile from defaults.
2019-01-11 12:41:53,448 - MainThread - botocore.hooks - DEBUG - Event choose-service-name: calling handler <function handle_service_name_alias at 0x000001961D257730>
2019-01-11 12:41:53,450 - MainThread - botocore.hooks - DEBUG - Event creating-client-class.lambda: calling handler <function add_generate_presigned_url at 0x000001961D19FF28>
2019-01-11 12:41:53,452 - MainThread - botocore.args - DEBUG - The s3 config key is not a dictionary type, ignoring its value of: None
2019-01-11 12:41:53,455 - MainThread - botocore.endpoint - DEBUG - Setting lambda timeout as (60, 60)
2019-01-11 12:41:53,457 - MainThread - botocore.client - DEBUG - Registering retry handlers for service: lambda
2019-01-11 12:41:53,475 - MainThread - botocore.hooks - DEBUG - Event before-parameter-build.lambda.UpdateFunctionCode: calling handler <function generate_idempotent_uuid at 0x000001961D2E6AE8>
2019-01-11 12:41:53,607 - MainThread - botocore.endpoint - DEBUG - Making request for OperationModel(name=UpdateFunctionCode) with params: {'url_path': '/2015-03-31/functions/###################################/code', 'query_string': {}, 'method': 'PUT', 'headers': {'User-Agent': 'aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7'}, 'body': b'{"ZipFile": "UEsDBBQAAAAIABZ2Kk6MMc..."}', 'url': 'https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/###############################/code', 'context': {'client_region': 'us-east-1', 'client_config': <botocore.config.Config object at 0x000002CF16D57128>, 'has_streaming_input': False, 'auth_type': None}}
2019-01-11 12:43:18,141 - MainThread - botocore.hooks - DEBUG - Event request-created.lambda.UpdateFunctionCode: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x000002CF16D57198>>
2019-01-11 12:43:18,148 - MainThread - botocore.hooks - DEBUG - Event choose-signer.lambda.UpdateFunctionCode: calling handler <function set_operation_specific_signer at 0x000002CF14E669D8>
2019-01-11 12:43:18,193 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2019-01-11 12:43:18,193 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
PUT
/2015-03-31/functions/###############################/code

host:lambda.us-east-1.amazonaws.com
x-amz-date:20190111T104318Z

host;x-amz-date
33a30325ede6631c605d7dd8fc83cb0200f609b587e0ff6821ae2b88e9d6ffea
2019-01-11 12:43:18,194 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20190111T104318Z
20190111/us-east-1/lambda/aws4_request
92c08cff0013f4216f1867da86748d396d5302483b73049c0a81c6356794ce6c
2019-01-11 12:43:18,195 - MainThread - botocore.auth - DEBUG - Signature:
######################################################
2019-01-11 12:43:18,195 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=PUT, url=https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/###############################/code, headers={'User-Agent': b'aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7', 'X-Amz-Date': b'20190111T104318Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=################/20190111/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=######################################################', 'Content-Length': '15340895'}>
2019-01-11 12:44:19,789 - MainThread - botocore.endpoint - DEBUG - Exception received when sending HTTP request.
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
ssl.SSLWantWriteError: The operation did not complete (write) (_ssl.c:2037)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 242, in send
    decode_content=False,
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\util\retry.py", line 343, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\packages\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
urllib3.exceptions.SSLError: The operation did not complete (write) (_ssl.c:2037)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 174, in _get_response
    http_response = self._send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 218, in _send
    return self.http_session.send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 260, in send
    raise SSLError(endpoint_url=request.url, error=e)
botocore.exceptions.SSLError: SSL validation failed for https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/###############################/code The operation did not complete (write) (_ssl.c:2037)
2019-01-11 12:44:19,816 - MainThread - botocore.hooks - DEBUG - Event needs-retry.lambda.UpdateFunctionCode: calling handler <botocore.retryhandler.RetryHandler object at 0x000002CF15F580F0>
2019-01-11 12:44:19,817 - MainThread - botocore.retryhandler - DEBUG - retry needed, retryable exception caught: SSL validation failed for https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/###############################/code The operation did not complete (write) (_ssl.c:2037)
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
ssl.SSLWantWriteError: The operation did not complete (write) (_ssl.c:2037)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 242, in send
    decode_content=False,
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\util\retry.py", line 343, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\packages\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
urllib3.exceptions.SSLError: The operation did not complete (write) (_ssl.c:2037)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 269, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 317, in __call__
    caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 174, in _get_response
    http_response = self._send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 218, in _send
    return self.http_session.send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 260, in send
    raise SSLError(endpoint_url=request.url, error=e)
botocore.exceptions.SSLError: SSL validation failed for https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/###############################/code The operation did not complete (write) (_ssl.c:2037)
2019-01-11 12:44:19,820 - MainThread - botocore.retryhandler - DEBUG - Retry needed, action of: 0.8963882468378392
2019-01-11 12:44:19,820 - MainThread - botocore.endpoint - DEBUG - Response received to retry, sleeping for 0.8963882468378392 seconds
2019-01-11 12:44:20,717 - MainThread - botocore.hooks - DEBUG - Event request-created.lambda.UpdateFunctionCode: calling handler <bound method RequestSigner.handler of <botocore.signers.RequestSigner object at 0x000002CF16D57198>>
2019-01-11 12:44:20,718 - MainThread - botocore.hooks - DEBUG - Event choose-signer.lambda.UpdateFunctionCode: calling handler <function set_operation_specific_signer at 0x000002CF14E669D8>
2019-01-11 12:44:20,799 - MainThread - botocore.auth - DEBUG - Calculating signature using v4 auth.
2019-01-11 12:44:20,800 - MainThread - botocore.auth - DEBUG - CanonicalRequest:
PUT
/2015-03-31/functions/###############################/code

host:lambda.us-east-1.amazonaws.com
x-amz-date:20190111T104420Z

host;x-amz-date
33a30325ede6631c605d7dd8fc83cb0200f609b587e0ff6821ae2b88e9d6ffea
2019-01-11 12:44:20,801 - MainThread - botocore.auth - DEBUG - StringToSign:
AWS4-HMAC-SHA256
20190111T104420Z
20190111/us-east-1/lambda/aws4_request
87579068e9d38b28b9617bb66917d6b7c3f70ffe36f0356bdb252a87d0910c5c
2019-01-11 12:44:20,802 - MainThread - botocore.auth - DEBUG - Signature:
######################################################
2019-01-11 12:44:20,802 - MainThread - botocore.endpoint - DEBUG - Sending http request: <AWSPreparedRequest stream_output=False, method=PUT, url=https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/###############################/code, headers={'User-Agent': b'aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7', 'X-Amz-Date': b'20190111T104420Z', 'Authorization': b'AWS4-HMAC-SHA256 Credential=################/20190111/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=######################################################', 'Content-Length': '15340895'}>

...

2019-01-11 12:48:36,132 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()
Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
socket.timeout: The write operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 242, in send
    decode_content=False,
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 638, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\util\retry.py", line 343, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\packages\six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\urllib3\connectionpool.py", line 354, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "http\client.py", line 1239, in request
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 125, in _send_request
    method, url, body, headers, *args, **kwargs)
  File "http\client.py", line 1285, in _send_request
  File "http\client.py", line 1234, in endheaders
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 152, in _send_output
    self.send(msg)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\awsrequest.py", line 236, in send
    return super(AWSConnection, self).send(str)
  File "http\client.py", line 986, in send
  File "ssl.py", line 965, in sendall
  File "ssl.py", line 935, in send
  File "ssl.py", line 636, in write
urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out',))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\awscli\clidriver.py", line 207, in main
    return command_table[parsed_args.command](remaining, parsed_args)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\awscli\clidriver.py", line 344, in __call__
    return command_table[parsed_args.operation](remaining, parsed_globals)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\awscli\clidriver.py", line 516, in __call__
    call_parameters, parsed_globals)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\awscli\clidriver.py", line 636, in invoke
    client, operation_name, parameters, parsed_globals)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\awscli\clidriver.py", line 648, in _make_client_call
    **parameters)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\client.py", line 320, in _api_call
    return self._make_api_call(operation_name, kwargs)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\client.py", line 610, in _make_api_call
    operation_model, request_dict)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 102, in make_request
    return self._send_request(request_dict, operation_model)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 136, in _send_request
    success_response, exception):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 205, in _needs_retry
    caught_exception=caught_exception, request_dict=request_dict)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\hooks.py", line 356, in emit
    return self._emitter.emit(aliased_event_name, **kwargs)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\hooks.py", line 228, in emit
    return self._emit(event_name, kwargs)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\hooks.py", line 211, in _emit
    response = handler(**kwargs)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 183, in __call__
    if self._checker(attempts, response, caught_exception):
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 251, in __call__
    caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 277, in _should_retry
    return self._checker(attempt_number, response, caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 317, in __call__
    caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 223, in __call__
    attempt_number, caught_exception)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\retryhandler.py", line 359, in _check_caught_exception
    raise caught_exception
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 174, in _get_response
    http_response = self._send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\endpoint.py", line 218, in _send
    return self.http_session.send(request)
  File "C:\Program Files\Amazon\AWSCLI\runtime\lib\site-packages\botocore\httpsession.py", line 273, in send
    endpoint_url=request.url
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/###############################/code".
2019-01-11 12:48:36,151 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255

Connection was closed before we received a valid response from endpoint URL: "https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/###############################/code".

aws 历史输出:

AWS CLI command entered
at time: 2019-01-11 12:41:02.670
with AWS CLI version: aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7
with arguments: ['lambda', 'update-function-code', '--function-name', '####################################################', '--zip-file', 'fileb://API.zip', '--debug']

[0] API call made
at time: 2019-01-11 12:42:29.095
to service: lambda
using operation: UpdateFunctionCode
with parameters: {
    "FunctionName": "####################################################",
    "ZipFile": "<Byte sequence>"
}

[0] HTTP request sent
at time: 2019-01-11 12:43:18.195
to URL: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/####################################################/code
with method: PUT
with headers: {
    "Authorization": "AWS4-HMAC-SHA256 Credential=####################/20190111/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=###############################################################",
    "Content-Length": "15340895",
    "User-Agent": "aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7",
    "X-Amz-Date": "20190111T104318Z"
}
with body: {
    "ZipFile": "UEsDBBQAAAAIABZ2Kk6MM..."
}

[0] HTTP request sent
at time: 2019-01-11 12:44:20.802
to URL: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/####################################################/code
with method: PUT
with headers: {
    "Authorization": "AWS4-HMAC-SHA256 Credential=####################/20190111/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=###############################################################",
    "Content-Length": "15340895",
    "User-Agent": "aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7",
    "X-Amz-Date": "20190111T104420Z"
}
with body: {
    "ZipFile": "UEsDBBQAAAAIABZ2Kk6MM..."
}

[0] HTTP request sent
at time: 2019-01-11 12:45:24.212
to URL: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/####################################################/code
with method: PUT
with headers: {
    "Authorization": "AWS4-HMAC-SHA256 Credential=####################/20190111/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=###############################################################",
    "Content-Length": "15340895",
    "User-Agent": "aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7",
    "X-Amz-Date": "20190111T104524Z"
}
with body: {
    "ZipFile": "UEsDBBQAAAAIABZ2Kk6MM..."
}

[0] HTTP request sent
at time: 2019-01-11 12:46:29.277
to URL: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/####################################################/code
with method: PUT
with headers: {
    "Authorization": "AWS4-HMAC-SHA256 Credential=####################/20190111/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=###############################################################",
    "Content-Length": "15340895",
    "User-Agent": "aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7",
    "X-Amz-Date": "20190111T104629Z"
}
with body: {
    "ZipFile": "UEsDBBQAAAAIABZ2Kk6MM..."
}

[0] HTTP request sent
at time: 2019-01-11 12:47:34.508
to URL: https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/####################################################/code
with method: PUT
with headers: {
    "Authorization": "AWS4-HMAC-SHA256 Credential=####################/20190111/us-east-1/lambda/aws4_request, SignedHeaders=host;x-amz-date, Signature=###############################################################",
    "Content-Length": "15340895",
    "User-Agent": "aws-cli/1.16.17 Python/3.6.0 Windows/10 botocore/1.12.7",
    "X-Amz-Date": "20190111T104734Z"
}
with body: {
    "ZipFile": "UEsDBBQAAAAIABZ2Kk6MM..."
}

AWS CLI command exited
at time: 2019-01-11 12:48:36.154
with return code: 255

我今天仍然遇到这个问题。 请进一步指教。

编辑:更新到最新版本的 aws cli (1.16.88) 会产生相同的结果。

我仍然遇到这个问题。 可能是什么问题?

我尝试重新上传一个大小相同的未更改项目,效果很好。

@moldstadt - 感谢您的反馈和耐心。 根据调试日志和历史输出,它似乎存在网络问题或超时。 更改后的项目和未更改的项目之间的网络有区别吗?

此问题已自动关闭,因为我们要求原作者提供更多信息的请求没有得到回应。 只有当前问题中的信息,我们没有足够的信息来采取行动。 如果您有或找到我们需要的答案,请联系我们,以便我们进一步调查。

@moldstadt你有没有解决过这个问题? 我花了几个小时调试同样的问题😣

谢谢!

尝试部署新的 lambda 代码时,我也遇到了这个问题。

部署到弹性 beantalk 时,我遇到了类似的问题。 我正在 Windows 上使用以下版本的 PowerShell: EB CLI 3.14.13 (Python 3.6.2)

重复的错误是:
(DEBUG) ebcli.lib.aws : Making api call: (s3, upload_part) to region: us-west-2 with args: {...}

今天仍然有同样的问题。 其他 lambda 命令可通过 cli 使用,但update-function-code继续返回相同的错误:

Connection was closed before we received a valid response from endpoint URL: "https://lambda.eu-west-2.amazonaws.com/2015-03-31/functions/test-fn/code".

我可以确认此错误发生在我测试过将代码上传到(us-east-1、us-east-2、eu-west-2)的所有区域中。

我还没有改变地重新安装了 awscli。 当前版本: aws-cli/1.16.132 Python/3.7.2 Darwin/18.0.0 botocore/1.12.122

希望这个问题能重新打开,因为似乎有更多人遇到了这个问题。

无论如何,我的问题似乎在几个小时后就自行解决了。

最终起作用的命令是将--debug标志添加到更新函数代码命令中,但我很确定这与分辨率无关。

为了后代的缘故,这些是我尝试过的,但_没有_解决问题的方法:

  1. 使用不同的访问密钥/秘密运行
  2. 以不同的 IAM 用户身份运行
  3. 在不同的网络上运行
  4. 在较新版本的 AWS CLI ( 1.16.130 ) 上运行
  5. 重新启动我的电脑

还值得注意的是,我的团队能够在发生此问题时运行命令(甚至使用我的 IAM 凭证),因此很可能是计算机的问题,而不是 AWS CLI。

我仍然遇到这个问题。 有时它有效,有时它
没有。

2019 年 3 月 27 日,星期三,15:46,William Pelrine通知@github.com 写道:

无论如何,我的问题似乎在几个小时后就自行解决了。

最终起作用的命令是将 --debug 标志添加到更新中
功能代码命令,但我很确定这与
决议。

为后人着想,这些是我尝试过的东西,但没有解决
问题:

  1. 使用不同的访问密钥/秘密运行
  2. 以不同的 IAM 用户身份运行
  3. 在不同的网络上运行
  4. 在较新版本的 AWS CLI (1.16.130) 上运行
  5. 重新启动我的电脑

值得注意的是,我的团队能够运行命令(甚至
使用我的 IAM 凭据)发生此问题时,因此非常
可能是计算机的问题,而不是 AWS CLI。


你收到这个是因为你被提到了。
直接回复本邮件,在GitHub上查看
https://github.com/aws/aws-cli/issues/3842#issuecomment-477161637或静音
线程
https://github.com/notifications/unsubscribe-auth/AVoOPyfE30twp3uA1Vzo0SsaHfNd-6uWks5va3YhgaJpZM4Z5fYF
.

也遇到这个问题

尝试使用 --debug 标志运行无效。

@moldstadt您是 mac osx 用户吗? 你是用自制软件安装的吗?

@moldstadt @inci90和其他遇到上述问题的人,我能够通过连接到另一个 wifi 网络来解决它。

这很奇怪,但是当我连接到我的电话网络时,上传总是可以使用/不使用--debug标志。 但由于某种原因,它在我的家庭网络上失败了。 我很好奇是什么导致了这个......

此问题似乎与本地计算机或网络问题有关,与 CLI 无关。 我暂时关闭此问题,但如果我们可以采取特定步骤来重现该问题,则可以重新打开。

现在这个问题对我来说已经消失了。 可以确认它似乎是网络问题。

我转移到另一个 wifi 网络,问题自行解决。

@inci90 - 感谢您的更新。

这仍然是一个问题。 我已经更改了 wifi,重新生成了访问密钥和秘密。 它现在给我带来了重大问题,因为我无法部署功能。 任何帮助将不胜感激。

我也有同样的问题,在 WSL ubuntu 18.04 上生成了一个新密钥

同样的问题:(,只上传了 7MB 的 zip 文件

@迪帕克-卡普尔,@musahaidari@ychennay -感谢你对这个问题的反馈。 我们希望关闭此问题,因为原始问题已被确认为网络问题。 请打开一个新问题并提供我们可以用来重现问题的步骤或提供调试日志的输出。 谢谢。

原问题已确认为网络问题

不, @moldstadt (原始问题的 OP)从未证实过这一点 - 您只是在https://github.com/aws/aws-cli/issues/3842#issuecomment -485448934 中断言它。

此问题似乎与本地计算机或网络问题有关,与 CLI 无关

这两者并不相互排斥。 根据我对这种情况的理解,存在网络问题并且 CLI 没有正确处理出现的网络问题。 错误/不足的错误处理绝对是 CLI 的问题。

我现在有这个问题。 这在我的工作场所和家里都有效。 现在它不再起作用了。 这不是大小问题(如果是这样,我希望 AWS 报告错误,而不仅仅是忽略请求)。 我认为这里需要一个更智能的 CLI。

FWIW:我只能在线上传(这需要一些时间)。 CLI 目前没有用。 自上次以来,文件大小的变化没有超过几个字节。 我的猜测是 CLI 工具超时太快,或者 AWS 目前太慢了。

我只是注意到停止杀毒软件在 WSL 1 上不起作用,它应该完全退出。 我正在使用卡巴斯基网络安全。

@rjamesnw @musahidari结果证明 AWS 网络或服务器存在一些问题,无论如何。 我的一些大学在不同的 ISP 上遇到了同样的问题,但我们所有的功能都驻留在eu-cental-1区域,可能其他地方的情况不同。

是的,几个小时后它变得更快了,CLI 再次快速运行。 现在没关系,因为我改用管道部署。

我可能只是很幸运,但在添加以下内容后它对我有用:

--cli-connect-timeout 6000

我认为 --cli-connect-timeout 6000 现在应该是 --connection-timeout 6000 这对我有用

只是在这里评论 --cli-connect-timeout 6000 对我有用。

从调试中可以清楚地看出,对于大型 zip 文件和/或慢速连接,在 zip 文件可以完全上传之前,连接超时。

用户不必猜测 cli-connect-timeout 的正确设置是什么,cli 不应使正在主动上传的请求超时。 所以在我看来这是一个错误。

FWIW 我相信正确的设置是 --cli-connect-timeout 0 不应该超时。

--cli-connect-timeout 6000 也对我有用

20 年 2 月:--cli-connect-timeout 6000 也对我有用

20 年 3 月:--cli-connect-timeout 6000
也为我工作

2020 年 3 月 23 日:--cli-connect-timeout 6000 是一个很好的解决方案

检查您的防病毒软件没有阻止连接。

防病毒软件强加的问题。 就我而言,它是卡巴斯基。 一旦 AV 退出,连接就完美无缺。

--cli-connect-timeout 6000 也对我有用,谢谢! 亚马逊应该更加了解该解决方案。

--cli-connect-timeout 6000 也对我有用,谢谢! 亚马逊应该更加了解该解决方案。

这对亚马逊来说不是问题。 这是网络和/或任何可能使用连接的问题(如我的情况下的防病毒软件)。

它可能是网络错误。
如果您已连接到 VPN,请断开连接后尝试
尝试更好的互联网连接
我的情况,关闭 VPN 有效

--cli-connect-timeout 6000 也对我有用,谢谢!

只是评论说这里提出的解决方案都不适合我。
我的 .zip 文件是 16.6 mb,添加 --cli-connect-timeout 6000 给了我一个签名过期错误。
切换到不同的网络也没有任何作用。

cli 是否为此提供了官方解决方案?

2020 年 7 月 23 日
家庭网络和 VPN 都不起作用。 --cli-connect-timeout 6000 有效
function.zip 是 38MB。

只是评论说这里提出的解决方案都不适合我。
我的 .zip 文件是 16.6 mb,添加 --cli-connect-timeout 6000 给了我一个签名过期错误。
切换到不同的网络也没有任何作用。

cli 是否为此提供了官方解决方案?

我不得不多次重试上传来解决这个问题。 我相信人们需要足够快的上传速度才能避免出现此消息。 否则,这是一个持续存在的问题,因为签名似乎在上传期间过期。

关闭 Mac bitdefender AV 没有帮助,但 --cli-connect-timeout 6000 为我修复了它。 文件大小只有 10 MB,农村 DSL 互联网 cxn(15 向下,1 向上)。

由于网络缓慢和上传量相对较大,看起来只是超时。

我也有这个问题,没有一个答案能解决我的问题。

  1. 当我在 s3 存储桶上启用加速时,这开始发生。
  2. 我已将accelerate正确配置true
  3. 这个晦涩的错误仅在 Windows 上使用git-bash
  4. 逻辑在矩阵中运行, macosubuntu运行相同的逻辑,没有错误。
  5. 每次下载都在完全相同的地方失败,这表明这不是超时问题。
  6. 除非具有加速传输的存储桶在后端使用 Lambda,否则我看不出 Lambda 与此有什么关系。 特别是考虑到在其他两个平台上使用完全相同的逻辑。

我将只为 Windows 切换cmd ,因为它可能会解决问题,但它使一切变得痛苦。

总是在大约42 MiB失败,低于上面建议的 50mb 限制。

Completed 41.2 MiB/136.6 MiB (1.3 MiB/s) with 1 file(s) remaining   
upload failed: .\***.tar.gz Connection was closed before we received a valid response from endpoint URL: "***.tar.gz".
fatal error: An error occurred (404) when calling the HeadObject operation: Key "***.tar.gz" does not exist
Completed 41.5 MiB/136.6 MiB (1.3 MiB/s) with 1 file(s) remaining   

万一它对某人有帮助,我试过了,它适用于我在农村地区。 我更改了python库代码重试了几次。 出于某种原因,在我的农村地区,它总是在第 4 次重试时进行。 但是当我在一家无线网络不好的酒店时,它仍然不会去。

更改文件 /lib/python3.8/http/client.py - 这是整个 send() 方法,我的更改标有注释:

def send(self, data):
    """Send `data' to the server.
    ``data`` can be a string object, a bytes object, an array object, a
    file-like object that supports a .read() method, or an iterable object.
    """

    if self.sock is None:
        if self.auto_open:
            self.connect()
        else:
            raise NotConnected()

    if self.debuglevel > 0:
        print("send:", repr(data))
    if hasattr(data, "read") :
        if self.debuglevel > 0:
            print("sendIng a read()able")
        encode = self._is_textIO(data)
        if encode and self.debuglevel > 0:
            print("encoding file using iso-8859-1")
        while 1:
            datablock = data.read(self.blocksize)
            if not datablock:
                break
            if encode:
                datablock = datablock.encode("iso-8859-1")
            self.sock.sendall(datablock)
        return
    try:
        # mowliv Edit 10/31/20
        count = 0
        while True:
            try:
                self.sock.sendall(data)
                break
            except socket.timeout:
                count += 1
                if count >= 8:
                    raise
                else:
                    print(f"mowliv: ssl send - retry {count}")

    except TypeError:
        if isinstance(data, collections.abc.Iterable):
            for d in data:
                self.sock.sendall(d)
        else:
            raise TypeError("data should be a bytes-like object "
                            "or an iterable, got %r" % type(data))

--cli-connect-timeout 6000也为我解决了这个问题

带有公司安全代理的家庭网络,连接时间很慢。
22M zip 有效载荷

版本:
aws-cli/2.1.4 Python/3.7.4 Darwin/18.7.0 exe/x86_64

其他 aws lambda 命令有效。 只是 aws lambda 更新函数代码超时。

对功能请求进行投票/评论以将--cli-connect-timeout 6000设为默认值:

https://github.com/aws/aws-cli/issues/5754

此页面是否有帮助?
0 / 5 - 0 等级