尝试使用gcloud CLI部署Cloud Function时出现错误

时间:2019-12-30 12:53:52

标签: google-cloud-platform google-cloud-functions gcloud

当我尝试使用gcloud CLI部署Google Cloud Function时,出现以下错误:

ERROR: (gcloud.functions.deploy) EOF occurred in violation of protocol (_ssl.c:727)
This may be due to network connectivity issues. Please check your network settings, and the status of the service you are trying to reach.

我重新安装了gcloud命令行工具,还运行了brew upgrade以更新Brew软件包,但对我不起作用。为什么会出现此错误?

1 个答案:

答案 0 :(得分:0)

错误出在您的计算机与服务之间的TLS | SSL协商中。可能是您的计算机,中介机构或Google。

您在代理人后面吗?如果有代理,则可能正在拦截呼叫。

您可以用gcloudgcloud functions list做其他事情吗?如果您可以发出其他命令(尤其是针对Cloud Functions的命令),则可能会怀疑这是Google的问题。如果不能,那么很可能是您的客户端(和/或代理)出错了

如果将--log-http附加到部署命令(或任何gcloud)命令,将收到更详细的日志记录,这可能会识别错误。

更新

我尝试通过创建新项目而不启用计费来重现该错误。我使用了hello-world示例(link),并且能够毫无问题地进行部署和测试。我怀疑问题是服务器(或区域)的间歇性问题。或者,很可能是您计算机上的配置出现了问题。

def hello_world(request):
        return "Hello World"

和requirements.txt:

flask==1.1.1

然后:

PROJECT=[[YOUR-PROJECT-ID]]
REGION=us-east1

gcloud projects create ${PROJECT}

gcloud services enable cloudfunctions.googleapis.com \
--project=${PROJECT}

gcloud functions deploy hello_world \
--region=${REGION} \
--project=${PROJECT} \
--entry-point=hello_world \
--runtime=python37 \
--source=${PWD} \
--trigger-http

成功部署后,我可以:

URL=$(\
  gcloud functions describe hello_world \
  --region=${REGION} \
  --project=${PROJECT} \
  --format="value(httpsTrigger.url)")
curl \
--silent \
--request GET \
"${URL}"
Hello World
相关问题