[英]"Service does not exist" in App Engine dispatch.yaml file
我最近进入了 GCP,现在正在尝试部署一个 angular 前端和一个 python 后端,相同的 AppEngine 应用程序但不同的服务。 问题是当我运行gcloud app deploy dispatch.yaml
我得到
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
似乎它应该是一个简单的修复,因为我找不到任何关于它的资源,但我只是看不到它
文件夹结构
-- appname/
---- display.yaml
---- client/
------ app.yaml (default - this one works)
------ dist/
---- server/
------ app.yaml (the troublemaker)
------ appname_backend/
app.yaml(工作之一):
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(它找不到的那个):
runtime: python310
env_variables:
BUCKET_NAME: 'appname-bucket-backend'
service: server
派遣:
dispatch:
- url: "*/favicon.ico"
service: default
- url: "*/api/*"
service: server
我读过的文档
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
(还有更多,但这些感觉最相关)
谷歌参考项目 Github https://github.com/GoogleCloudPlatform/issuetracker/tree/c783a93af2c9214c13b3777a4b2da366ce65f248/services
它已经在您共享的文档之一中提到,即:
在部署调度文件之前,您必须确保该文件中定义的所有服务都已部署到 App Engine。
好像您还没有在App Engine
中创建名为“server”的service
您的前端服务似乎是您的默认服务,因此不会产生任何错误。 但是后端提到的服务还没有创建。 因此你得到了错误
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
使用以下评论部署应用程序,这也有助于为您的后端创建服务。
gcloud app deploy dispatch.yaml <path_to_backend.yaml>
IE
gcloud app deploy dispatch.yaml backend/app.yaml
参考您分享的github
代码
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.