1
votes

I am making a nodejs project for google app engine. Testing is all fine and the app is functional, but when prompted to deploy my code files via gcloud app deploy, I am given the following error:

ERROR: An app.yaml (or appengine-web.xml) file is required to deploy this directory as an App Engine application

I have never used yaml before. What should the contents of a basic yaml file look like to fix this problem and deploy my code?

2

2 Answers

3
votes

As you can see at https://docs.ansible.com/ansible/latest/reference_appendices/YAMLSyntax.html, YAML's basic is simple as as follows:

Dictionary - key: value


List/Array (1) -
name: - item1 - item2
List/Array (2) - name: ["item1", "item2"]
Nested Properties (1) -
nest: nestedKey: value nestedList: - item1 - item2

Regarding the specific YAML file you specified, read up on https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml for more information.
Here's a simple example from that page:

runtime: java
env: flex

handlers:
- url: /.*
  script: this field is required, but ignored
0
votes

For node your current options are nodejs10 and nodejs12:

Accepted runtimes are: [php, php55, python27, java, java7, java8, go111, go112, go113, go114, java11, nodejs10, nodejs12, php72, php73, php74, python37, python38, ruby25]

So an example app.yaml file, using a node server and the standard environment, would be:

runtime: nodejs12
env: standard

handlers:
- url: /.*
  script: auto

Note that some versions may have additional requirements eg:

script field for handler '/.*' must be set to 'auto' for runtime nodejs12.