Issue understanding installation error with App Engine Flexible – Java SDK?

Tags: , ,



I am currently trying a simple App Engine Flexible app and struggling with what I think is a setup and permissions issue. I have tried various different install methods – using gcloud and Maven, and also IntelliJ with the app engine add in, but they all fail.

Below is the output from the console:

ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation projects/n*********/regions/us-central1/operations/6360c25d-5d39-4035-a5d9-fa11cff89d1c error [INTERNAL]: An internal error occurred while processing task /appengine-flex-v1/insert_flex_deployment/flex_create_resources>2020-06-23T21:37:26.966Z10514.ow.2: Deployment Manager operation n**********/operation-1592948248075-5a8c72a78db77-432a52c5-14b80019 errors: [code: "RESOURCE_ERROR"
location: "/deployments/aef-default-20200623t223343/resources/aef-default-20200623t223343"
message: "{"ResourceType":"compute.beta.regionAutoscaler","ResourceErrorCode":"403","ResourceErrorMessage":{"code":403,"message":"The caller does not have permission","status":"PERMISSION_DENIED","statusMessage":"Forbidden","requestPath":"https://compute.googleapis.com/compute/beta/projects/n**********/regions/us-central1/autoscalers","httpMethod":"POST"}}"
]

Failed to deploy '[2020-06-23 22:33:38] test2.jar. Project: n********. Version: auto': Deployment failed with exit code: 1
Please make sure that you are using the latest version of the Google Cloud SDK.
Run ''gcloud components update'' to update the SDK. (See: https://cloud.google.com/sdk/gcloud/reference/components/update.)

When I open the Status Message, the following error is inside:

"error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "errors": [
      {
        "message": "Login Required.",
        "domain": "global",
        "reason": "required",
        "location": "Authorization",
        "locationType": "header"
      }
    ],
    "status": "UNAUTHENTICATED"
  }

Having followed the Google quick start and some of the other examples, I am struggling to understand what is going wrong and what I need to do to fix the issue. Any insights would be much appreciated.

Answer

This appears to be an issue with your service account permissions as per the indication on the gcloud.app.deploy error:

“The caller does not have permission”

You should check if the service account that you are using to deploy the project has the proper permissions by following the instruction on this documentation, the App Engine Deployer role is the recommended one for deploying apps, if this does not work you could try to use the Editor role as well, here is the documentation for the app engine service account roles for you to check a bit further.

Also, you could try to disable and re-enable the Cloud Build API, this will make all the permission be re-created and override any permissions that were broken for your service account.

NOTE: Your service account name should be something like this: [YOUR_PROJECT_NAME]@appspot.gserviceaccount.com.



Source: stackoverflow