【发布时间】:2019-07-05 15:38:04
【问题描述】:
我正在尝试使用 Java Client API 创建 Google Cloud Function,但不断收到错误代码 400 和消息“前提条件检查失败”。
我了解这是由于我的输入参数之一的格式错误,但没有任何指示。
调用代码
CloudFunction function = new CloudFunction();
function.setName("mytest1");
function.setAvailableMemoryMb(128);
function.setSourceArchiveUrl("gs://my-bucket/path/to/source.zip");
function.setRuntime("python37");
function.setEntryPoint("my_function_name");
function.setTimeout("450s");
String location = "projects/my-project-id/locations/us-east4";
cloudFunctions.projects().locations().functions().create(location, function).execute(); // exception thrown here
我还尝试将函数的serviceAccountEmail 设置为我正在使用的服务帐户密钥,并且还设置了HttpsTrigger。
此 API 的 JavaDoc 表示只需要运行时,但仅使用此集运行它也不起作用。
错误
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Precondition check failed.",
"reason" : "failedPrecondition"
} ],
"message" : "Precondition check failed.",
"status" : "FAILED_PRECONDITION"
}
【问题讨论】:
标签: java google-cloud-platform google-cloud-functions