gcloud app deploy flexible environment hangs

Viewed 520

Title is self explanatory. I simply downloaded the flexible-hello-world app and deployed it without (almost) a single modification - I deployed it to a service called some-service using this app.yaml

# Copyright 2017, Google, Inc.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# [START gae_flex_quickstart_yaml]
runtime: nodejs
env: flex
service: some-service

# This sample incurs costs to run on the App Engine flexible environment.
# The settings below are to reduce costs during testing and are not appropriate
# for production use. For more information, see:
# https://cloud.google.com/appengine/docs/flexible/nodejs/configuring-your-app-with-app-yaml
manual_scaling:
  instances: 1
resources:
  cpu: 1
  memory_gb: 0.5
  disk_size_gb: 10

# [END gae_flex_quickstart_yaml]

I have a billing account enabled for my project.

It hangs at this line:

...
7104cb4c0c814fa53787009 size: 2385
Finished Step #1
PUSH
DONE
--------------------------------------------------------------------------------------------------------------------------------------------------------------

Updating service [some-service] (this may take several minutes)...⠹    

When I go to the app engine console I see it has deployed and can access the URL here: https://some-service-dot-ashored-cloud-dv.uk.r.appspot.com/

But the 502 never goes away.

Help!

EDIT:

Some more information, while it is still hung on the deploy command, I run this in another terminal:

gcloud app instances list --service some-service

and I get:

SERVICE       VERSION          ID                                      VM_STATUS   DEBUG_MODE
some-service  20201119t184828  aef-some--service-20201119t184828-fr7n  TERMINATED

EDIT 2:

When I try to ssh to it I get more weirdness:

gcloud app instances ssh aef-some--service-20201119t184828-fr7n --service some-service --version 20201119t184828

WARNING: This instance is serving live application traffic.  Any changes made could
result in downtime or unintended consequences.
Do you want to continue (Y/n)?  

Sending public key to instance [apps/ashored-cloud-dv/services/some-service/versions/20201119t184828/instances/aef-some--service-20201119t184828-fr7n].
Waiting for operation [apps/ashored-cloud-dv/operations/9de7b298-f4e9-47a7-8a8e-11411e649d50] to complete...done.                                            
ERROR: gcloud crashed (TypeError): can only concatenate str (not "NoneType") to str

EDIT 2:

glcloud --version output:

Google Cloud SDK 319.0.0
bq 2.0.62
cloud-build-local 
core 2020.11.13
gsutil 4.55
1 Answers

tl;dr; permissions

I removed the editor permission from my default app engine service account as recommended in the IAM dashboard.

Nowhere in the docs (that I could find) does it tell you what permissions are needed to deploy a app engine flexible service.

Turns out, you need:

Logs Writer
Storage Object Viewer

Without Storage Object Viewer you'll get an error on deployment telling you the exact issue. Without Logs Writer you will not get an error, but the service will never come up.

What a long 10 days...

EDIT: I was wrong, it says here in the docs what permissions you need.

I asked Google Support to file an internal bug that the correct error message is not being returned if you do not have Logs Writer

Related