3

我在下面做 aws-sam-cli 官方教程时出错。
https://github.com/awslabs/aws-sam-cli#invoke-functions-locally

本教程说下面的命令正在调用函数。

$ sam local invoke "Ratings" -e event.json

但是在完成下面的教程之后,template.yaml中有资源“HelloWorldFunction”,

$ sam init

所以,我在下面命令。

$ sam local invoke HelloWorldFunction -e event.json

我得到了错误。

2018-06-26 18:44:21 Invoking app.lambda_handler (nodejs8.10)
2018-06-26 18:44:21 Found credentials in shared credentials file: ~/.aws/credentials
Traceback (most recent call last):
  File "/Users/XXXX/.local/lib/python3.6/site-packages/samcli/local/docker/manager.py", line 108, in has_image
    self.docker_client.images.get(image_name)
AttributeError: 'function' object has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/XXXX/.local/bin/sam", line 11, in <module>
    load_entry_point('aws-sam-cli==0.4.0', 'console_scripts', 'sam')()
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/Users/XXXX/.pyenv/versions/3.6.0/lib/python3.6/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Users/XXXX/.local/lib/python3.6/site-packages/samcli/commands/local/invoke/cli.py", line 44, in cli
    docker_network, log_file, skip_pull_image, profile)  # pragma: no cover
  File "/Users/XXXX/.local/lib/python3.6/site-packages/samcli/commands/local/invoke/cli.py", line 76, in do_cli
    stderr=context.stderr)
  File "/Users/XXXX/.local/lib/python3.6/site-packages/samcli/commands/local/lib/local_lambda.py", line 80, in invoke
    stdout=stdout, stderr=stderr)
  File "/Users/XXXX/.local/lib/python3.6/site-packages/samcli/local/lambdafn/runtime.py", line 83, in invoke
    self._container_manager.run(container)
  File "/Users/XXXX/.local/lib/python3.6/site-packages/samcli/local/docker/manager.py", line 52, in run
    if not self.has_image(image_name) or not self.skip_pull_image:
  File "/Users/XXXX/.local/lib/python3.6/site-packages/samcli/local/docker/manager.py", line 110, in has_image
    except docker.errors.ImageNotFound:
AttributeError: module 'docker.errors' has no attribute 'ImageNotFound'

我使用 macOS High Sierra 10.13.3。

4

0 回答 0