今天开始,我无法使用 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 小时前使用相同的脚本,但现在 - 团队中没有人能够部署云功能并收到相同的错误。
在 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=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
作为入口点。
关于google-cloud-platform - 谷歌云功能部署启动失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60073380/