Failure deploying AppEngine version because of Clo

2019-07-27 11:08发布

问题:

I am trying to deploy to Google AppEngine. (More precisely: Managed VM.)

I ran gcloud preview app deploy d:\dev\mytest\yaml-war\app.yaml --version=joshua20160316d --project=mytest-test1.

After about 30 minutes, it failed.

The error message directs me to log lines in the Cloud Developer Console (see below) which tell me that access to the Cloud Storage JSON API needs to be enabled. However, the Developer Console shows that the Cloud Storage JSON API is already enabled. (See screenshot.)

Also, note that this works for other team members; and that the same command against a different project also succeeded. So, it is some sort of setting specific to the project and my account, but I don't know what.

What do I need to do to make this work?

Failure setting up GCS logging: failed to create GCS logging client: error creating logfile: googleapi: Error 403: Access Not Configured. The API (Cloud Storage JSON API) is not enabled for your project. Please use the Google Developers Console to update your configuration., accessNotConfigured
{
 metadata: {
  severity:     "INFO"
  projectId: "mytest-test1"
  serviceName: "cloudbuild.googleapis.com"
  labels: {     
    cloudbuild.googleapis.com/build_id:
  "49697866-90f8-4771-82ef-7fe149f1d926"
  }
  timestamp: "2016-03-16T14:19:10.940059809Z"
  projectNumber: "232473234717"
 }
 textPayload: "Failure setting up GCS logging: failed to create GCS logging client: error creating logfile: googleapi: Error 403: Access Not Configured. The API (Cloud Storage JSON API) is not enabled for your project. Please use the Google Developers Console to update your configuration., accessNotConfigured"
 insertId: "41697866-90f8-4771-82ef-8fe149f1d926-0"
 log: "41697866-90f8-4771-82ef-8fe149f1d926"
}

The local log includes the following.

Operation [operations/build/mytest-test1/MmFmNjFhNGQtZDU2Yi00NzczLWI5NTItNWYyNGYyZGYyM2FkOlAT] complete. Result: {
    "metadata": {
        "@type": "type.googleapis.com/google.devtools.cloudbuild.v1.BuildOperationMetadata", 
        "build": {
            "finishTime": "2016-03-16T13:35:28.453575Z", 
            "status": "FAILURE", 
            "timeout": "600.000s", 
            "startTime": "2016-03-16T13:35:28.199428Z", 
            "workerId": "worker-74ace662-26dc-47c5-b23b-0886f61a5fbe", 
            "logsBucket": "staging.mytest-test1.appspot.com", 
            "userId": "846527075559", 
            "results": {}, 
            "id": "2af61a4d-d57b-4773-b952-5e24f2df23ad", 
            "buildReceipt": {
                "clientId": "32555940559"
            }, 
            "source": {
                "storageSource": {
                    "object": "mytest-test1.default.joshua20160316d", 
                    "bucket": "staging.mytest-test1.appspot.com"
                }
            }, 
            "steps": [
                {
                    "args": [
                        "appengine.gcr.io/gcloud/mytest-test1.default.joshua20160316d"
                    ], 
                    "name": "gcr.io/cloud-builders/dockerizer"
                }
            ], 
            "sourceProvenance": {
                "resolvedStorageSource": {
                    "generation": "1458135324271000", 
                    "object": "mytest-test1.default.joshua20160316d", 
                    "bucket": "staging.mytest-test1.appspot.com"
                }
            }, 
            "projectId": "mytest-test1", 
            "images": [
                "appengine.gcr.io/gcloud/mytest-test1.default.joshua20160316d"
            ], 
            "projectNum": "232473234717", 
            "foremanId": "cloud-build/foreman.server/ir/0", 
            "createTime": "2016-03-16T13:35:26.145234Z"
        }
}, 
"done": true, 
"name": "operations/build/mytest-test1/MmFmNjFhNGQtZDU2Yi00NzczLWI5NTItNWYyNGYyZGYyM2FkOlAT", 
"error": {
    "message": "Build failed; check build logs for details", 
    "code": 2
}

}

回答1:

This may sound silly, but have you tried disabling and re-enabling the API? https://console.developers.google.com/apis/api/storage_api/overview?project=232474234717 (you have a screenshot of this). [yes, tried; didn't help]

Second, you could try specifying your own GCS bucket with the --bucket flag. By default the build uses a special bucket that is automatically set up for your project.

Finally, if you specify --use_cloud_build=0, you will enable the legacy build system where a VM will spin up in your project, do the build, and then shut down. The newer cloud build service is intended to replace the legacy system and is 1-2 minutes faster.

I'm sorry you are hitting a roadblock here.