0
votes

I am trying to deploy a nodejs project to Google Cloud and got the following error in the Google Cloud SDK Shell after entering gcloud app deploy. I have done the following prior to deploying. (I outlined the steps in quotation block because of some weird formatting issue with the code below that, it's not actually quoting from anywhere). Thanks a bunch!

  1. Created a project in Google Cloud
  2. Created app.yaml in the same folder as my app.js. I specified runtime:nodejs and env:flex for the app.yaml
  3. I set the port to 8080 and added "start": "node app.js", to package.json
  4. I opened Google Cloud SDK Shell then entered: gcloud auth login. Then I entered gcloud config set project and put in my project ID. Then I entered: gcloud app deploy.
WARNING: Automatic app detection is deprecated and will soon be removed. 
As an alternative, create an app.yaml file yourself using the directions at 
https://cloud.google.com/appengine/docs/flexible/python/configuring-your-app-
with-app-yaml (App Engine Flexible Environment) or 
https://cloud.google.com/appengine/docs/standard/python/config/appref (App 
Engine Standard Environment) under the tab for your language.
Deployment to Google App Engine requires an app.yaml file. This
command will run `gcloud beta app gen-config` to generate an app.yaml for you in 
the current directory (if the current directory does not contain an App Engine 
service, please answer "no").
2

2 Answers

0
votes

I fixed it by committing my files to my local repository. I don't really know why, but it that's the only thing I changed and it worked.

0
votes

The gcloud app deploy deployment command you used didn't specify the app.yaml for the service to be deployed. Depending on the invocation context/environment the automatic logic for detection (or generation) of the file doesn't always yield the result users may be expecting, hence the warning.

The fix (and general recommendation) would be to always specify the file in the deployment command (instead of relying on the not 100% reliable automatic detection/generation), like this:

gcloud app deploy [path_to/]app.yaml