温馨提示:本文翻译自stackoverflow.com,查看原文请点击:其他 - google cloud function deploy start failing
gcloud google-cloud-functions google-cloud-platform

其他 - 谷歌云功能部署开始失败

发布于 2020-04-20 14:05:00

今天开始,我无法使用gcloud cli部署云功能。

这是我使用gloud部署云功能的命令:

gcloud functions deploy chatbot_api_gateway_002_test --runtime python37 --trigger-http --entry-point process --set-env-vars VERIFICATION_TOKEN=sometokenhere,PUBSUB_TOPIC=entrypointfunction001,GOOGLE_CLOUD_PROJECT=cs-be-dev,DEST_URL=__undefined_yet__,DEST_URLS_TIMEOUT=2 --memory=2GB --region=asia-northeast1

我收到一个错误:

部署功能(可能需要一段时间-最多2分钟)...失败。

错误:(gcloud.functions.deploy)OperationError:代码= 3,消息=生成失败:生成超时

我曾经在1个小时前使用相同的脚本,但现在-团队中没有人能够部署云功能并遇到相同的错误。

部署失败

在stackdrive日志中,我仅看到以下内容:

 {
 insertId: "rr5a8qctoo"  
 logName: "projects/be-dev/logs/cloudaudit.googleapis.com%2Factivity"  

operation: {
  id: "operations/c2F0YWNzLWJlLWRldi9hc2lhLW5vcnRoZWFzdDEvY2hhdGJvdF9hcGlfZ2F0ZXdheV8wMDJfdGVzdC9SMGdpR0ZRWk13aw"   
  last: true   
  producer: "cloudfunctions.googleapis.com"   
 }

protoPayload: {
  @type: "type.googleapis.com/google.cloud.audit.AuditLog"   

authenticationInfo: {
   principalEmail: "myemail@domain.com"    
  }
  methodName: "google.cloud.functions.v1.CloudFunctionsService.CreateFunction"   

requestMetadata: {

destinationAttributes: {
   }

requestAttributes: {
   }
  }
  resourceName: "projects/be-dev/locations/asia-northeast1/functions/chatbot_api_gateway_002_test"   
  serviceName: "cloudfunctions.googleapis.com"   

status: {
   code: 3    
   message: "INVALID_ARGUMENT"    
  }
 }
 receiveTimestamp: "2020-02-05T09:53:42.771914617Z"  

resource: {

labels: {
   function_name: "chatbot_api_gateway_002_test"    
   project_id: "be-dev"    
   region: "asia-northeast1"    
  }
  type: "cloud_function"   
 }
 severity: "ERROR"  
 timestamp: "2020-02-05T09:53:42.153Z"  
}

关于如何修复它有什么建议吗?

查看更多

提问者
user1503452
被浏览
20
Martin Zeitler 2020-02-05 20:45

它会读取,message: "INVALID_ARGUMENT"因此任何参数都可能不正确(更改日志有时会列出重大更改)。查看gcloud functions deploy和比较;例如:

允许的值为:128MB,256MB,512MB,1024MB和2048MB。

因此,2GB最终可能是一个INVALID_ARGUMENT并且(NAME : --region=REGION)也被声明为位置参数。尝试使用--verbosity=info获得更多输出debug

gcloud functions deploy \
    chatbot_api_gateway_002_test \
    --region=asia-northeast1 \
    --runtime python37
    --trigger-http \
    --memory=2048MB \
    --verbosity=info

--entry-point通常是函数的目录名称,
例如。helloworld对于functions/helloworld/main.py为切入点。