“dispatch.yaml updating returns 500” 翻译成中文是 “dispatch.yaml 更新返回 500″。

huangapple go评论59阅读模式
英文:

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: &quot;website.com/*&quot;
    module: service1
  - url: &quot;subdomain1.website.com/*&quot;
    module: service2
  - url: &quot;subdomain2.website.com/*&quot;
    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&#39;&lt;h3&gt;Server Error&lt;/h3&gt;&lt;p&gt;A server error has occurred.&lt;/p&gt;&#39;

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: &quot;debug&quot;, DEPLOYABLES:1: &quot;[&#39;dispatch.yaml&#39;]&quot;]
DEBUG: Making request: POST https://oauth2.googleapis.com/token
DEBUG: Loading runtimes experiment config from [gs://runtime-builders/experiments.yaml]
INFO: Reading [&lt;googlecloudsdk.api_lib.storage.storage_util.ObjectReference object at 0x7f571e15ffa0&gt;]
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={&#39;X-appcfg-api-version&#39;: &#39;1&#39;, &#39;content-length&#39;: &#39;227&#39;, &#39;Content-Type&#39;: &#39;application/octet-stream&#39;} 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={&#39;X-appcfg-api-version&#39;: &#39;1&#39;, &#39;content-length&#39;: &#39;227&#39;, &#39;Content-Type&#39;: &#39;application/octet-stream&#39;} 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: &quot;website.com/*&quot;
    service: service1
  - url: &quot;*.website.com/*&quot;
    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

  1. module 已被弃用,现在称为 'service'。因此,请在您的 dispatch.yaml 文件中将每个 'module' 实例更改为 'service'。您还需要在您的 app.yaml 文件中进行相同的更改。

    请参阅 文档,其中提到

    service: 指定将处理与 URL 模式匹配的请求的服务的名称。请注意,服务以前称为模块

  2. 即使您的 dispatch.yaml 文件成功部署,它也不会按您的预期工作。您的第一个规则指定任何以 website.com/* 结尾的 URL 应该路由到 service1.

    subdomain1.website.com/*subdomain2.website.com/* 都满足上述条件。这意味着来自上述两个来源的流量也将被路由到 service1。为满足您的要求,website.com/* 的条目应该是最后的条目(而不是第一个)。

    逻辑是 - 首先检查子域名是否以 subdomain1 结尾并路由到 service2,否则检查是否以 subdomain2 结尾并路由到 service3,否则路由到 service1。

  3. 您还应该注意,PHP 5 已被弃用,GAE 不再积极支持它

英文:
  1. 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.

  2. 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

  3. You should also note that PHP 5 has been deprecated and GAE is no longer actively supporting it.

huangapple
  • 本文由 发表于 2023年4月11日 16:24:59
  • 转载请务必保留本文链接:https://go.coder-hub.com/75983830.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定