Я работаю в macOS High Sierra и пытаюсь запустить sam-cli для локальной отладки лямбд. Лямбда-среда выполнения: nodejs8.10, SAM CLI, версия 0.4.0
Я использую следующую команду
sam local invoke --event payload.json --debug-port 5858 [lambdaName] --profile [profileName]
Вызывается отладчик, и я могу отладить лямбда-код некоторое время, прежде чем истечет время ожидания докера.
`Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/sam", line 11, in <module>
load_entry_point('aws-sam-cli==0.4.0', 'console_scripts', 'sam')()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 1066, 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 1066, 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 895, 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 535, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 44, in cli
docker_network, log_file, skip_pull_image, profile) # pragma: no cover
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/commands/local/invoke/cli.py", line 76, in do_cli
stderr=context.stderr)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 80, in invoke
stdout=stdout, stderr=stderr)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/local/lambdafn/runtime.py", line 98, in invoke
container.wait_for_logs(stdout=stdout, stderr=stderr)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/local/docker/container.py", line 187, in wait_for_logs
self._write_container_output(logs_itr, stdout=stdout, stderr=stderr)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/local/docker/container.py", line 206, in _write_container_output
for frame_type, data in output_itr:
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/local/docker/attach_api.py", line 98, in _read_socket
payload_type, payload_size = _read_header(socket)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/samcli/local/docker/attach_api.py", line 170, in _read_header
data = read_exactly(socket, 8)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docker/utils/socket.py", line 47, in read_exactly
next_data = read(socket, n - len(data))
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/docker/utils/socket.py", line 31, in read
return socket.recv(n)
socket.timeout: timed out`
Это мой шаблон sam
`AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
lambda Description
# More info about Globals: https://github.com/awslabs/serverless-application-model/blob/master/docs/globals.rst
Globals:
Function:
Timeout: 300
Resources:
LambdaName:
Type: AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
Properties:
Handler: index.handler
Runtime: nodejs8.10
Environment:
Variables:
NODE_TLS_REJECT_UNAUTHORIZED : "0"
BUCKET_NAME : "bucketName"
KEY_NAME : "file.json"
DYNAMO_RULE_TABLE : "TableName"
NODE_ENV: "development" # NODE_ENV: "production"`
Мне не удалось найти причину этой проблемы.