英文:
dispatch.yaml updating returns 500
问题
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 the 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 retries (a total of 3 times).
I've missed something?
EDIT:
Even changing "module" to "service," I still got a 500 error.
dispatch:
- url: "website.com/*"
service: service1
- url: "*.website.com/*"
service: service1
I've tried upgrading the SDK too, but I got this error:
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.
英文:
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.
答案1
得分: 1
-
module已被弃用,现在称为 'service'。因此,请在您的dispatch.yaml文件中将每个 'module' 实例更改为 'service'。您还需要在您的app.yaml文件中进行相同的更改。请参阅 文档,其中提到
service: 指定将处理与 URL 模式匹配的请求的服务的名称。请注意,服务以前称为模块。
-
即使您的
dispatch.yaml文件成功部署,它也不会按您的预期工作。您的第一个规则指定任何以website.com/*结尾的 URL 应该路由到service1.subdomain1.website.com/*和subdomain2.website.com/*都满足上述条件。这意味着来自上述两个来源的流量也将被路由到service1。为满足您的要求,website.com/*的条目应该是最后的条目(而不是第一个)。逻辑是 - 首先检查子域名是否以 subdomain1 结尾并路由到 service2,否则检查是否以 subdomain2 结尾并路由到 service3,否则路由到 service1。
-
您还应该注意,PHP 5 已被弃用,GAE 不再积极支持它。
英文:
-
modulehas been deprecated. It's now called 'service'. So, change every instance of 'module' to 'service' in yourdispatch.yamlfile. You'll also have to make the same changes in yourapp.yamlfile.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.yamlfile is successfully deployed, it won't work the way you expect it to. Your first rule says any url that ends inwebsite.com/*should get routed toservice1.Both
subdomain1.website.com/*andsubdomain2.website.com/*meet the above criteria. This means traffic from the above 2 will also get routed toservice1. To meet your requirement, the entry forwebsite.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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论