我是Lambda的新手,请访问以下教程:
一切正常,直到“本地测试应用程序”步骤为止。应用程序启动正常,我得到了最后的启动行:在http://127.0.0.1:3000上运行 但是,当我对http://127.0.0.1:3000/hello进行GET调用时,控制台中出现了一个很大的错误堆栈(如下所示)。
我已严格按照设置说明进行操作。 AWS CLI可以正常工作。我在AWS云上有许多lambda示例,这是我第一次在本地AWS SAM CLI上尝试。已安装Docker,但我也是Docker的新手,因此不确定其设置是否正确。
我在2台不同的PC上遇到了这个完全相同的错误。一个是带有Docker Toolbox版本的Windows 7,另一个是带有标准Docker的Windows 10。
有人能指出我正确的方向吗?
谢谢。
2018-10-30 14:13:19 Invoking app.lambda_handler (python3.6)
2018-10-30 14:13:19 Found credentials in shared credentials file: ~/.aws/credent
ials
Fetching lambci/lambda:python3.6 Docker container image......
2018-10-30 14:13:20 Mounting C:\ces\lambda\HelloWorld2\sam-app\hello_world\build
as /var/task:ro inside runtime container
2018-10-30 14:13:20 Exception on /hello [GET]
Traceback (most recent call last):
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\docker\api\client.py", line 229, in _raise_for_status
response.raise_for_status()
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\requests\models.py", line 939, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url:
https://192.168.99.100:2376/v1.35/containers/create
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\flask\app.py", line 2292, in wsgi_app
response = self.full_dispatch_request()
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\flask\app.py", line 1815, in full_dispatch_request
rv = self.handle_user_exception(e)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\flask\app.py", line 1718, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\flask\_compat.py", line 35, in reraise
raise value
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\flask\app.py", line 1813, in full_dispatch_request
rv = self.dispatch_request()
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\flask\app.py", line 1799, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\samcli\local\apigw\local_apigw_service.py", line 140, in _request_handler
self.lambda_runner.invoke(route.function_name, event, stdout=stdout_stream,
stderr=self.stderr)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\samcli\commands\local\lib\local_lambda.py", line 80, in invoke
self.local_runtime.invoke(config, event, debug_context=self.debug_context, s
tdout=stdout, stderr=stderr)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\samcli\local\lambdafn\runtime.py", line 79, in invoke
self._container_manager.run(container)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\samcli\local\docker\manager.py", line 61, in run
container.create()
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\samcli\local\docker\container.py", line 120, in create
real_container = self.docker_client.containers.create(self._image, **kwargs)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\docker\models\containers.py", line 824, in create
resp = self.client.api.create_container(**create_kwargs)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\docker\api\container.py", line 411, in create_container
return self.create_container_from_config(config, name)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\docker\api\container.py", line 422, in create_container_from_config
return self._result(res, True)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\docker\api\client.py", line 235, in _result
self._raise_for_status(response)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\docker\api\client.py", line 231, in _raise_for_status
raise create_api_error_from_http_exception(e)
File "c:\users\073940\appdata\local\programs\python\python37-32\lib\site-packa
ges\docker\errors.py", line 31, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation)
docker.errors.APIError: 500 Server Error: Internal Server Error ("invalid volume
specification: 'C:\ces\lambda\HelloWorld2\sam-app\hello_world\build:/var/task:r
o'")
2018-10-30 14:13:20 127.0.0.1 - - [30/Oct/2018 14:13:20] "GET /hello HTTP/1.1" 5
02 -