GAE flex app deployment failing with error code 400

google-app-enginegoogle-cloud-platform

I have been deploying a GAE flex app successfully over the last months.
I am now attempting to deploy the same application into another project that I have created as my staging environment.

The code is exactly the same, the app.yaml has only changed to reflect a new database and redis connections which I pass as environment variables.

The build goes well, but at the end I get the following:

"metadata": {
    "target": "apps/freesat-stage-project/services/default/versions/athiqtest4",
    "method": "google.appengine.v1.Versions.CreateVersion",
    "user": "sys@example.co.uk",
    "insertTime": "2017-11-08T11:11:59.089Z",
    "ephemeralMessage": "Deployment failed. Attempting to cleanup deployment artifacts.",
    "@type": "type.googleapis.com/google.appengine.v1.OperationMetadataV1"
},
"done": true,
"name": "apps/freesat-stage-project/operations/2e41e4e5-b9bd-42fb-9fd3-319ec322458b",
"error": {
    "message": "Deployment Manager operation failed, name: operation-1510139527034-55d76c211f490-1fcc927b-d3b3b590, error: [{\"code\":\"RESOURCE_ERROR\",\"location\":\"/deployments/aef-default-athiqtest4/resources/aef-default-athiqtest4-00ahs\",\"message\":\"{\\\"ResourceType\\\":\\\"compute.v1.httpsHealthCheck\\\",\\\"ResourceErrorCode\\\":\\\"400\\\",\\\"ResourceErrorMessage\\\":{\\\"code\\\":400,\\\"errors\\\":[{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.timeoutSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.unhealthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.healthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"}],\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"statusMessage\\\":\\\"Bad Request\\\",\\\"requestPath\\\":\\\"https://www.googleapis.com/compute/v1/projects/freesat-stage-project/global/httpsHealthChecks\\\",\\\"httpMethod\\\":\\\"POST\\\"}}\"}, {\"code\":\"RESOURCE_ERROR\",\"location\":\"/deployments/aef-default-athiqtest4/resources/aef-default-athiqtest4-hcs\",\"message\":\"{\\\"ResourceType\\\":\\\"compute.v1.httpsHealthCheck\\\",\\\"ResourceErrorCode\\\":\\\"400\\\",\\\"ResourceErrorMessage\\\":{\\\"code\\\":400,\\\"errors\\\":[{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.timeoutSec': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.unhealthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"},{\\\"domain\\\":\\\"global\\\",\\\"message\\\":\\\"Invalid value for field 'resource.healthyThreshold': '0'. Must be greater than or equal to 1\\\",\\\"reason\\\":\\\"invalid\\\"}],\\\"message\\\":\\\"Invalid value for field 'resource.checkIntervalSec': '0'. Must be greater than or equal to 1\\\",\\\"statusMessage\\\":\\\"Bad Request\\\",\\\"requestPath\\\":\\\"https://www.googleapis.com/compute/v1/projects/freesat-stage-project/global/httpsHealthChecks\\\",\\\"httpMethod\\\":\\\"POST\\\"}}\"}]",
    "code": 13
}

My app.yaml looks as follow:

runtime: custom
env: flex

env_variables:
 REDIS_HOST: 10.154.0.3
 REDIS_PORT: 6379
 DB_NAME: freesat
 DB_USER: freesat-stage
 DB_PASS: password
 DB_HOST: /cloudsql/freesat-stage-project:europe-west2:freesat-stage
 GS_BUCKET_NAME: freesat-content
 DJANGO_CONF: conf.production
 JANRAIN_CLIENT_ID: clientid
 JANRAIN_SECRET: secret
 DOTMAILER_API_USER: api@apiconnector.com
 DOTMAILER_API_PASS: pass

health_check:
  enable_health_check: False

automatic_scaling:
  min_num_instances: 4
  max_num_instances: 15
  cpu_utilization:
    target_utilization: 0.4

beta_settings:
  cloud_sql_instances: 'freesat-stage-project:europe-west2:freesat-stage'

resources:
  cpu: 2
  memory_gb: 2

I cannot make sense of the error message. Any help would be appreicated.

Best Answer

Newly created App Engine projects now make use of the updated Split Health Checks.

This means that your attempt to disable the legacy health checks with enable_health_check in your app.yaml is the cause of the issue.

Therefore you may either remove the legacy health_check settings from your yaml file, or disable the new split health checks for your project (and continue using the legacy health checks) by running the gcloud command gcloud beta app update --no-split-health-checks --project [YOUR_PROJECT_ID] to resolve the issue.

Related Topic