首页 > 解决方案 > 谷歌云功能部署开始失败

问题描述

今天开始,我无法使用 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"  
}

请问有什么解决方法的建议吗?

标签: google-cloud-platformgoogle-cloud-functionsgcloud

解决方案


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

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

因此2GB可能最终是一个INVALID_ARGUMENT并且(NAME : --region=REGION)也被声明为一个位置参数。尝试使用--verbosity=infoor获得更多输出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入口点。


推荐阅读