Search code examples
pythongoogle-app-enginegoogle-cloud-platformgcloudgdal

ERROR: (gcloud.app.deploy) Error Response: [13] in deploying flex environment in Google App Engine


I'm trying to get GDAL to work in Google App Engine. I've been following this post. I've got a similar app.yaml and Dockerfile alongside my script and requirements.txt as a part of my deployment folder. I'm getting the following error after running

gcloud app deploy
Updating service [default] (this may take several minutes)...failed.
                                                                                                                                                                                                                 
ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation projects
/flex-env-gdal-api/regions/us-central1/operations/230ef197-33ab-43ee-bbac-85b53e6c8fd0 

error [INTERNAL]: An internal error occurred while processing task 
/appengine-flex-v1/insert_flex_deployment/flex_create_resources>
2020-07-20T19:50:34.913Z71509.jo.14: Deployment Manager operation 
flex-env-gdal-api/operation-1595274635522-5aae4d1f830ec-81a3f5de-b5b771bf 

errors: [code: "RESOURCE_ERROR" location: "/deployments/aef-default 20200720t144747/resources/aef-default-20200720t144747" 
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/flex-env-gdal-api/regions/us-central1/autoscalers\",
\"httpMethod\":\"POST\"}}"
]

After doing some looking around, Error Response [13] seems to be associated with permissions. I have the Owner role in the IAM, so I'm not sure that's the issue. If anybody has any suggestions of things to try, I'd greatly appreciate it.


Solution

  • I've ran into similar issues and the workaround was to specify the number of instances to a maximum of two, this can be done either through manual_scaling or max_num_instances while using automatic scaling.

    Your app.yaml file would something similar to:

    Using automatic scaling

    runtime: custom
    env: flex
    entrypoint: gunicorn -b :$PORT mysite.wsgi
    runtime_config:
      python_version: 3.7
    automatic_scaling:
      min_num_instances: 1
      max_num_instances: 2
    

    Using manual scaling:

    runtime: custom
    env: flex
    entrypoint: gunicorn -b :$PORT mysite.wsgi
    runtime_config:
      python_version: 3.7
    manual_scaling:
      instances: 2