3
votes

I'm trying to use the Google Cloud web API to create an App in App Engine as described in the official documentation (https://cloud.google.com/appengine/docs/admin-api/creating-an-application). I use:

When I do an HTTP POST using node-fetch as follow:

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'
    })
})

Then I receive this error message:

{
 "code": 409,
 "message": "This application already exists and cannot be re-created.",
 "status": "ALREADY_EXISTS"
}

It's really weird as my project id as no App Engine defined yet.

Does anyone know what's happening here?

1
What do you get if you run "gcloud app describe" in the Cloud Shell for that project or from your local machine with gcloud set up for this project? Does it say "The current Google Cloud project does not contain an App Engine application"?LundinCast

1 Answers

3
votes

At least a while ago creating a project (manually) automatically created the GAE app resource associated with it. From the doc you referenced:

If you choose to use an existing GCP project, you must ensure that the project does not already contain the Application resource because projects support only a single App Engine application. To check if your GCP project already contains the Application resource, you can use either the apps.get method or run the gcloud app describe command.