-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Description
I am just following the serverless quick start tutorial. I've installed Docker already (Docker version 18.09.2, build 6247962).
Steps to reproduce
sam init -r nodejs -d npmsam local invoke HelloWorldFunction --event event.json
Observed result
2019-07-02 20:00:56 Using SAM Template at /Users/dylan/Tutorials/aws/serverless-quick-start/sam-app/template.yaml
2019-07-02 20:00:56 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-07-02 20:00:56 Changing event name from before-call.apigateway to before-call.api-gateway
2019-07-02 20:00:56 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-07-02 20:00:56 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-07-02 20:00:56 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-07-02 20:00:56 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-07-02 20:00:56 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-07-02 20:00:56 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-07-02 20:00:56 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-07-02 20:00:56 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-07-02 20:00:56 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-07-02 20:00:56 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-07-02 20:00:56 Changing event name from before-call.apigateway to before-call.api-gateway
2019-07-02 20:00:56 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-07-02 20:00:56 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-07-02 20:00:56 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-07-02 20:00:56 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-07-02 20:00:56 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-07-02 20:00:56 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-07-02 20:00:56 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-07-02 20:00:56 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-07-02 20:00:56 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-07-02 20:00:56 local invoke command is called
2019-07-02 20:00:56 No Parameters detected in the template
2019-07-02 20:00:56 2 resources found in the template
2019-07-02 20:00:56 Found Serverless function with name='HelloWorldFunction' and CodeUri='hello-world/'
2019-07-02 20:00:56 Trying paths: ['/Users/dylan/.docker/config.json', '/Users/dylan/.dockercfg']
2019-07-02 20:00:56 Found file at path: /Users/dylan/.docker/config.json
2019-07-02 20:00:56 Found 'auths' section
2019-07-02 20:00:56 Auth data for https://index.docker.io/v1/ is absent. Client might be using a credentials store instead.
2019-07-02 20:00:56 Found 'credsStore' section
2019-07-02 20:00:56 http://localhost:None "GET /v1.35/_ping HTTP/1.1" 200 2
2019-07-02 20:00:56 Trying paths: ['/Users/dylan/.docker/config.json', '/Users/dylan/.dockercfg']
2019-07-02 20:00:56 Found file at path: /Users/dylan/.docker/config.json
2019-07-02 20:00:56 Found 'auths' section
2019-07-02 20:00:56 Auth data for https://index.docker.io/v1/ is absent. Client might be using a credentials store instead.
2019-07-02 20:00:56 Found 'credsStore' section
2019-07-02 20:00:56 Found one Lambda function with name 'HelloWorldFunction'
2019-07-02 20:00:56 Invoking app.lambdaHandler (nodejs)
2019-07-02 20:00:56 No environment variables found for function 'HelloWorldFunction'
2019-07-02 20:00:56 Environment variables overrides data is standard format
2019-07-02 20:00:56 Loading AWS credentials from session with profile 'None'
2019-07-02 20:00:56 Changing event name from creating-client-class.iot-data to creating-client-class.iot-data-plane
2019-07-02 20:00:56 Changing event name from before-call.apigateway to before-call.api-gateway
2019-07-02 20:00:56 Changing event name from request-created.machinelearning.Predict to request-created.machine-learning.Predict
2019-07-02 20:00:56 Changing event name from before-parameter-build.autoscaling.CreateLaunchConfiguration to before-parameter-build.auto-scaling.CreateLaunchConfiguration
2019-07-02 20:00:56 Changing event name from before-parameter-build.route53 to before-parameter-build.route-53
2019-07-02 20:00:56 Changing event name from request-created.cloudsearchdomain.Search to request-created.cloudsearch-domain.Search
2019-07-02 20:00:56 Changing event name from docs.*.autoscaling.CreateLaunchConfiguration.complete-section to docs.*.auto-scaling.CreateLaunchConfiguration.complete-section
2019-07-02 20:00:56 Changing event name from before-parameter-build.logs.CreateExportTask to before-parameter-build.cloudwatch-logs.CreateExportTask
2019-07-02 20:00:56 Changing event name from docs.*.logs.CreateExportTask.complete-section to docs.*.cloudwatch-logs.CreateExportTask.complete-section
2019-07-02 20:00:56 Changing event name from before-parameter-build.cloudsearchdomain.Search to before-parameter-build.cloudsearch-domain.Search
2019-07-02 20:00:56 Changing event name from docs.*.cloudsearchdomain.Search.complete-section to docs.*.cloudsearch-domain.Search.complete-section
2019-07-02 20:00:56 Looking for credentials via: env
2019-07-02 20:00:56 Looking for credentials via: assume-role
2019-07-02 20:00:56 Looking for credentials via: shared-credentials-file
2019-07-02 20:00:56 Looking for credentials via: custom-process
2019-07-02 20:00:56 Looking for credentials via: config-file
2019-07-02 20:00:56 Looking for credentials via: ec2-credentials-file
2019-07-02 20:00:56 Looking for credentials via: boto-config
2019-07-02 20:00:56 Looking for credentials via: container-role
2019-07-02 20:00:56 Looking for credentials via: iam-role
2019-07-02 20:00:56 Converted retries value: False -> Retry(total=False, connect=None, read=None, redirect=0, status=None)
2019-07-02 20:00:56 Starting new HTTP connection (1): 169.254.169.254:80
2019-07-02 20:00:57 Caught retryable HTTP exception while making metadata service request to http://169.254.169.254/latest/meta-data/iam/security-credentials/: Connect timeout on endpoint URL: "http://169.254.169.254/latest/meta-data/iam/security-credentials/"
Traceback (most recent call last):
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/connection.py", line 160, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/util/connection.py", line 80, in create_connection
raise err
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/util/connection.py", line 70, in create_connection
sock.connect(sa)
socket.timeout: timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/botocore/httpsession.py", line 262, in send
chunked=self._chunked(request.headers),
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/connectionpool.py", line 641, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/util/retry.py", line 344, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/packages/six.py", line 686, in reraise
raise value
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/connectionpool.py", line 603, in urlopen
chunked=chunked)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/connectionpool.py", line 355, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/botocore/awsrequest.py", line 125, in _send_request
method, url, body, headers, *args, **kwargs)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/botocore/awsrequest.py", line 152, in _send_output
self.send(msg)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/botocore/awsrequest.py", line 236, in send
return super(AWSConnection, self).send(str)
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/connection.py", line 183, in connect
conn = self._new_conn()
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/urllib3/connection.py", line 165, in _new_conn
(self.host, self.timeout))
urllib3.exceptions.ConnectTimeoutError: (<botocore.awsrequest.AWSHTTPConnection object at 0x10f5fccc0>, 'Connection to 169.254.169.254 timed out. (connect timeout=1)')
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/botocore/utils.py", line 303, in _get_request
response = self._session.send(request.prepare())
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/botocore/httpsession.py", line 286, in send
raise ConnectTimeoutError(endpoint_url=request.url, error=e)
botocore.exceptions.ConnectTimeoutError: Connect timeout on endpoint URL: "http://169.254.169.254/latest/meta-data/iam/security-credentials/"
2019-07-02 20:00:57 Max number of attempts exceeded (1) when attempting to retrieve data from metadata service.
2019-07-02 20:00:57 Resolving code path. Cwd=/Users/dylan/Tutorials/aws/serverless-quick-start/sam-app, CodeUri=hello-world/
2019-07-02 20:00:57 Resolved absolute path to code is /Users/dylan/Tutorials/aws/serverless-quick-start/sam-app/hello-world
2019-07-02 20:00:57 Code /Users/dylan/Tutorials/aws/serverless-quick-start/sam-app/hello-world is not a zip/jar file
2019-07-02 20:00:57 Skipping building an image since no layers were defined
2019-07-02 20:00:57 Trying paths: ['/Users/dylan/.docker/config.json', '/Users/dylan/.dockercfg']
2019-07-02 20:00:57 Found file at path: /Users/dylan/.docker/config.json
2019-07-02 20:00:57 Found 'auths' section
2019-07-02 20:00:57 Auth data for https://index.docker.io/v1/ is absent. Client might be using a credentials store instead.
2019-07-02 20:00:57 Found 'credsStore' section
2019-07-02 20:00:57 http://localhost:None "GET /v1.35/images/lambci/lambda:nodejs/json HTTP/1.1" 200 None
2019-07-02 20:00:57 Looking for auth config
2019-07-02 20:00:57 Using credentials store "osxkeychain"
2019-07-02 20:00:57 Looking for auth entry for 'https://index.docker.io/v1/'
2019-07-02 20:00:57 Found auth config
2019-07-02 20:00:58 http://localhost:None "POST /v1.35/images/create?tag=nodejs&fromImage=lambci%2Flambda HTTP/1.1" 200 None
Fetching lambci/lambda:nodejs Docker container image......
2019-07-02 20:00:58 Mounting /Users/dylan/Tutorials/aws/serverless-quick-start/sam-app/hello-world as /var/task:ro,delegated inside runtime container
2019-07-02 20:00:58 http://localhost:None "POST /v1.35/containers/create HTTP/1.1" 201 90
2019-07-02 20:00:58 http://localhost:None "GET /v1.35/containers/842ebb63b47d26eed69c9b15269c2a7aef4b11abc891ce27949e9a00e0a1b936/json HTTP/1.1" 200 None
2019-07-02 20:00:58 http://localhost:None "GET /v1.35/containers/842ebb63b47d26eed69c9b15269c2a7aef4b11abc891ce27949e9a00e0a1b936/json HTTP/1.1" 200 None
2019-07-02 20:00:59 http://localhost:None "POST /v1.35/containers/842ebb63b47d26eed69c9b15269c2a7aef4b11abc891ce27949e9a00e0a1b936/start HTTP/1.1" 400 187
2019-07-02 20:00:59 http://localhost:None "GET /v1.35/containers/842ebb63b47d26eed69c9b15269c2a7aef4b11abc891ce27949e9a00e0a1b936/json HTTP/1.1" 200 None
2019-07-02 20:00:59 http://localhost:None "DELETE /v1.35/containers/842ebb63b47d26eed69c9b15269c2a7aef4b11abc891ce27949e9a00e0a1b936?v=False&link=False&force=True HTTP/1.1" 204 0
Traceback (most recent call last):
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/docker/api/client.py", line 261, in _raise_for_status
response.raise_for_status()
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.35/containers/842ebb63b47d26eed69c9b15269c2a7aef4b11abc891ce27949e9a00e0a1b936/start
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/bin/sam", line 11, in <module>
load_entry_point('aws-sam-cli==0.17.0', 'console_scripts', 'sam')()
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/samcli/commands/local/invoke/cli.py", line 56, in cli
parameter_overrides) # pragma: no cover
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/samcli/commands/local/invoke/cli.py", line 100, in do_cli
stderr=context.stderr)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/samcli/commands/local/lib/local_lambda.py", line 93, in invoke
self.local_runtime.invoke(config, event, debug_context=self.debug_context, stdout=stdout, stderr=stderr)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/samcli/local/lambdafn/runtime.py", line 86, in invoke
self._container_manager.run(container)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/samcli/local/docker/manager.py", line 98, in run
container.start(input_data=input_data)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/samcli/local/docker/container.py", line 187, in start
real_container.start()
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/docker/models/containers.py", line 400, in start
return self.client.api.start(self.id, **kwargs)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/docker/api/container.py", line 1093, in start
self._raise_for_status(res)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/docker/api/client.py", line 263, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "/usr/local/Cellar/aws-sam-cli/0.17.0/libexec/lib/python3.7/site-packages/docker/errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 400 Client Error: Bad Request ("OCI runtime create failed: container_linux.go:344: starting container process caused "exec: \"/usr/bin/node\": stat /usr/bin/node: no such file or directory": unknown")
Expected result
I expected the lambda function to run locally and successfully.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
- OS: MacOS Mojave 10.14.4 (18E227)
sam --version: SAM CLI, version 0.17.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels