I have my dispatch.yaml file like this:
dispatch:
- url: "website.com/*"
module: service1
- url: "subdomain1.website.com/*"
module: service2
- url: "subdomain2.website.com/*"
module: service3
I should update service3 with another subdomain, by changing it from dispatch.yaml and using the command gcloud app deploy dispatch.yaml
I got a 500 error code from server
ERROR: (gcloud.app.deploy) Server responded with code [500]:
Internal Server Error.
b'<h3>Server Error</h3><p>A server error has occurred.</p>'
I am currently using Google Cloud SDK 319.0.0 (I have PHP5 standard env on app engine), verbosity returns this
gcloud app deploy dispatch.yaml --verbosity=debug
DEBUG: Running [gcloud.app.deploy] with arguments: [--verbosity: "debug", DEPLOYABLES:1: "['dispatch.yaml']"]
DEBUG: Making request: POST https://oauth2.googleapis.com/token
DEBUG: Loading runtimes experiment config from [gs://runtime-builders/experiments.yaml]
INFO: Reading [<googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x7f571e15ffa0>]
DEBUG: API endpoint: [https://appengine.googleapis.com/], API version: [v1]
DEBUG: Making request: POST https://oauth2.googleapis.com/token
Configurations to update:
descriptor: [/mnt/c/Users/user/project/dispatch.yaml]
type: [routing rules]
target project: [project]
Updating config [dispatch]...DEBUG: Host: appengine.google.com
DEBUG: _Authenticate configuring auth; needs_auth=False
DEBUG: Sending request to https://appengine.google.com/api/dispatch/update?app_id=website-live headers={'X-appcfg-api-version': '1', 'content-length': '227', 'Content-Type': 'application/octet-stream'} body=dispatch:
Updating config [dispatch]...⠛DEBUG: Got http error 500.
DEBUG: Retrying. This is attempt 1 of 3.
DEBUG: _Authenticate configuring auth; needs_auth=False
DEBUG: Sending request to https://appengine.google.com/api/dispatch/update?app_id=website-live headers={'X-appcfg-api-version': '1', 'content-length': '227', 'Content-Type': 'application/octet-stream'} body=dispatch:
Output is the same each time it retry (total 3 times)
I've missed something?
EDIT: Even changing "module" to "service", got always 500
dispatch:
- url: "website.com/*"
service: service1
- url: "*.website.com/*"
service: service1
I've tried upgrading SDK too, got this
ERROR: (gcloud.app.deploy) Apps instance [project] is the subject of a conflict: Cannot operate on apps/project because an operation is already in progress for apps/project by a01scd73-7h7ef-411-adac-289bfle0f5.
module
has been deprecated. It's now called 'service'. So, change every instance of 'module' to 'service' in your dispatch.yaml
file. You'll also have to make the same changes in your app.yaml
file.
See documentation which says
service: Specifies the name of the service that will handle the requests that match the url pattern. Note that services were previously called modules.
Even after your dispatch.yaml
file is successfully deployed, it won't work the way you expect it to. Your first rule says any url that ends in website.com/*
should get routed to service1
.
Both subdomain1.website.com/*
and subdomain2.website.com/*
meet the above criteria. This means traffic from the above 2 will also get routed to service1
. To meet your requirement, the entry for website.com/*
should be the last entry (and not the first).
The logic is then - first check if the subdomain ends in subdomain1 and route to service2, else check if it ends in subdomain2 and route to service3 else route to service1
You should also note that PHP 5 has been deprecated and GAE is no longer actively supporting it.