我正在尝试使用Google Cloud Web API在App Engine中创建应用程序,如官方文档(https://cloud.google.com/appengine/docs/admin-api/creating-an-application)中所述。我用:
当我使用node-fetch
进行HTTP POST时如下:
fetch('https://appengine.googleapis.com/v1/apps', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${token}`
},
body: JSON.stringify({
id: projectId,
locationId:'australia-southeast1'
})
})
然后我收到此错误消息:
{
"code": 409,
"message": "This application already exists and cannot be re-created.",
"status": "ALREADY_EXISTS"
}
这真的很奇怪,因为我的项目ID还没有定义App Engine。
有谁知道这里发生了什么?
至少在不久前创建一个项目(手动)自动创建与之关联的GAE应用程序资源。从您引用的文档:
如果选择使用现有GCP项目,则必须确保项目尚未包含
Application
资源,因为项目仅支持单个App Engine应用程序。要检查您的GCP项目是否已包含Application
资源,您可以使用apps.get method或运行gcloud app describe
命令。