google-cloud-platform - 谷歌云功能部署启动失败

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

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

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

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

我收到错误:

Deploying function (may take a while - up to 2 minutes)...failed.

ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Build failed: Build has timed out

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

deployment failed

在 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: "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dfb2a6bab2beb6b39fbbb0b2beb6b1f1bcb0b2" rel="noreferrer noopener nofollow">[email protected]</a>"    
  }
  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"  
}

请问有什么解决办法吗?

最佳答案

它读取消息:“INVALID_ARGUMENT”,因此任何参数都可能不正确(更改日志有时会列出重大更改)。请参阅gcloud functions deploy并进行比较;例如:

Allowed values are: 128MB, 256MB, 512MB, 1024MB, and 2048MB.

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

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

--entry-point 通常是函数的目录名称,
例如。 helloworldfunctions/helloworld/main.py 作为入口点。

关于google-cloud-platform - 谷歌云功能部署启动失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60073380/

相关文章:

node.js - Firebase Cloud Firestore 触发器 context.auth 始终为 null

go - 如何配置 cloud.google.com/go/logging 使其看起来像写入标准输出的日志?

ubuntu - 将数据集从我的 PC 上传到 Google Cloud Platform 上的虚拟机实例的最佳方式

google-cloud-platform - 我可以向项目添加组织级 gcp 自定义角色吗?

google-app-engine - 如何使用 go 1.11 和 Google App Engine Standard 验证私有(private) Go 模块

google-cloud-platform - GCP-存储 : do files appear before upload is complete

Firebase 云函数触发器

google-cloud-platform - "gcloud auth application-default login"和 "gcloud auth login"的区别

在 GCP 云函数上运行 R 和包

mysql - 通过Google代理将本地Spring Boot应用程序连接到Google Cloud SQL