0

GAE will not update the deployed code through gcloud. For instance, I created this method:

main.py

@app.route('/test',methods=['GET'])
def test():
    print 'print test'
    return 'test'

app.yaml

runtime: python27
api_version: 1
threadsafe: true

runtime_config:
  python_version: 2

instance_class: F2  

handlers:
- url: /.*
  script: main.app

libraries:
- name: flask
  version: 0.12

deploy the app:

gcloud app deploy app.yaml queue.yaml --project $PROJECT

Then I get a 404 when visiting /test.

I tracked down the log error:

This request caused a new process to be started for your application, and thus caused your application code to be loaded for the first time. This request may thus take longer and use more CPU than a typical request for your application.

I looked at this article, which noted that I shouldn't be getting the error every time I visit the URL. I do.

I added --verbosity=info to my deployment and everything looked great except:

INFO: Could not find any remote repositories associated with [path-to-app]. Cloud diagnostic tools may not be able to display the correct source code for this deployment.

The code appeared updated in the dedugger, which is strange. The latest version is 100% deployed in the App Engine Dashboard.

This is really confusing because on deployment, there isn't a repo, but the code appears in the debugger but the end point won't function because there aren't enough resources.

There seems to be a lot happening here and not sure what the issue is.

Update

Some posts recommend a warmup. I followed the guidelines here and still, no dice. I'm getting a 404 when visiting /test and /_ah/warmup.

ethanenglish
  • 1,217
  • 2
  • 15
  • 32
  • The "This request caused..." log is basically just announcing a cold start for the request and is expected upon initial deployment. Also, you don't need to specify `runtime_config`. Also, try only specifying Flask in your `requirements.txt` file and not in `app.yaml`. – swigganicks Jul 25 '18 at 17:26

1 Answers1

2

This issue could be caused by multiple different reasons, there could be a lot of factors in play, in most cases the error 404 shows when the app.yaml failed to allocate the flask library as the ‘flask’ libraries by default not bundled in the libraries the Google App Engine includes. So it needs to be added manually. One of the way to figure out if the issue is a deployment issue is to go to this link (https://console.cloud.google.com/logs/viewer) and check if there is any logs recorded or not. If there is no log appearing in the viewer it could very well mean that the problem occurred even before it actually knocks the server.

Additionally, I would highly recommend you to go through the following link (https://codelabs.developers.google.com/codelabs/cloud-vision-app-engine/index.html?index=..%2F..%2Findex#0) to deploy flask on the Google Cloud App Engine environment.

Also, I would like to make a suggestion to try a workaround using the ‘webapp2’ library if possible. The link is the following (http://webapp2.readthedocs.io/en/latest/index.html)

I have also noticed there is an attempt to run the queue.yaml. It is important to configure the file accordingly as well.

To summarize, I would really appreciate if you could try all the different possibilities to deploy the flask library and observe the results. Thank you so much.

Sami Islam
  • 96
  • 6