I have recently gotten into GCP, and am now trying to deploy an angular frontend with a python backend, same AppEngine application but different services. The problem is that when I run gcloud app deploy dispatch.yaml
I get
Updating config [dispatch]...failed.
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: The request contained an invalid argument.
- '@type': type.googleapis.com/google.rpc.BadRequest
fieldViolations:
- description: Service 'server' does not exist.
field: dispatch_rules
Seems like it should be an easy fix, as I can't find any resources about it, but I just don't see it
Folder structure
-- appname/
---- display.yaml
---- client/
------ app.yaml (default - this one works)
------ dist/
---- server/
------ app.yaml (the troublemaker)
------ appname_backend/
app.yaml (the working one):
runtime: nodejs16
instance_class: F2
env_variables:
BUCKET_NAME: "appname-bucket"
handlers:
- url: /
static_files: dist/index.html
upload: dist/index.html
- url: /
static_dir: dist
app.yaml (the one it can't find):
runtime: python310
env_variables:
BUCKET_NAME: 'appname-bucket-backend'
service: server
dispatch:
dispatch:
- url: "*/favicon.ico"
service: default
- url: "*/api/*"
service: server
Documentation I have read
https://cloud.google.com/appengine/docs/standard/configuration-files https://cloud.google.com/appengine/docs/legacy/standard/python/reference/dispatch-yaml https://cloud.google.com/appengine/docs/legacy/standard/python/how-requests-are-routed https://cloud.google.com/appengine/docs/standard/communicating-between-services https://cloud.google.com/appengine/docs/standard/reference/app-yaml?tab=python
(and lots more, but these felt the most relevant)
Google reference project on Github https://github.com/GoogleCloudPlatform/issuetracker/tree/c783a93af2c9214c13b3777a4b2da366ce65f248/services
CodePudding user response:
It is already mentioned in one of the document you shared, i.e:
Before you deploy your dispatch file, you must ensure that all the services defined in that file have already been deployed to App Engine.
Seems like you have not created service
named “server” yet in App Engine
Your frontend service seems to be your default so it’s not generating any errors. But the service mentioned in the backend is not yet created. Hence you are getting the error
Updating config [dispatch]...failed.
ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: The request contained an invalid argument.
- '@type': type.googleapis.com/google.rpc.BadRequest
fieldViolations:
- description: Service 'server' does not exist.
field: dispatch_rules
Deploy app using below comment which also helps to create Service for your backend.
gcloud app deploy dispatch.yaml <path_to_backend.yaml>
I.e
gcloud app deploy dispatch.yaml backend/app.yaml
With reference to github
code you shared