运行 sls 部署时无服务器挂起。 Docker 命令未结束
Serverless hangs when running sls deploy. Docker command not ending
我正在关注 this tutorial 以使用 python.
设置无服务器 AWS lambda
我想 运行 这个简单的 httprequest 函数(驻留在 httprequest.py 中)与无服务器 lambda:
import requests
def handler(event, context):
r = requests.get("https://news.ycombinator.com/news")
return {"content": r.text}
以下是我的serveless.yaml:
service: serverlessProj
frameworkVersion: '2'
provider:
name: aws
runtime: python3.8
functions:
hello:
handler: hello.handler
httprequest:
handler: httprequest.handler
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: true
现在,如您所见,自定义部分告诉无服务器-python-requirements 插件在 Docker 容器中编译 Python 包。它应该安装 requirements.txt 中的插件。这是requirements.txt的内容:
requests
当运行宁sls deploy
时,这是控制台输出:
Serverless: Generated requirements from /Users/user/Desktop/ShoeSwiper/Serverless/requirements.txt in /Users/user/Desktop/ShoeSwiper/Serverless/.serverless/requirements.txt...
Serverless: Installing requirements from /Users/user/Library/Caches/serverless-python-requirements/007/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.8
Serverless: Using download cache directory /Users/user/Library/Caches/serverless-python-requirements/downloadCacheslspyc
Serverless: Running docker run --rm -v /Users/user/Library/Caches/serverless-python-requirements/007\:/var/task\:z -v /Users/user/Library/Caches/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z -u 0 lambci/lambda\:build-python3.8 python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache...
然后就卡住了。知道出了什么问题。我错过了什么吗?
好的,一切正常。该命令并没有挂起,只是需要花费很多时间。耐心是关键。
我正在关注 this tutorial 以使用 python.
设置无服务器 AWS lambda我想 运行 这个简单的 httprequest 函数(驻留在 httprequest.py 中)与无服务器 lambda:
import requests
def handler(event, context):
r = requests.get("https://news.ycombinator.com/news")
return {"content": r.text}
以下是我的serveless.yaml:
service: serverlessProj
frameworkVersion: '2'
provider:
name: aws
runtime: python3.8
functions:
hello:
handler: hello.handler
httprequest:
handler: httprequest.handler
plugins:
- serverless-python-requirements
custom:
pythonRequirements:
dockerizePip: true
现在,如您所见,自定义部分告诉无服务器-python-requirements 插件在 Docker 容器中编译 Python 包。它应该安装 requirements.txt 中的插件。这是requirements.txt的内容:
requests
当运行宁sls deploy
时,这是控制台输出:
Serverless: Generated requirements from /Users/user/Desktop/ShoeSwiper/Serverless/requirements.txt in /Users/user/Desktop/ShoeSwiper/Serverless/.serverless/requirements.txt...
Serverless: Installing requirements from /Users/user/Library/Caches/serverless-python-requirements/007/requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.8
Serverless: Using download cache directory /Users/user/Library/Caches/serverless-python-requirements/downloadCacheslspyc
Serverless: Running docker run --rm -v /Users/user/Library/Caches/serverless-python-requirements/007\:/var/task\:z -v /Users/user/Library/Caches/serverless-python-requirements/downloadCacheslspyc\:/var/useDownloadCache\:z -u 0 lambci/lambda\:build-python3.8 python3.8 -m pip install -t /var/task/ -r /var/task/requirements.txt --cache-dir /var/useDownloadCache...
然后就卡住了。知道出了什么问题。我错过了什么吗?
好的,一切正常。该命令并没有挂起,只是需要花费很多时间。耐心是关键。