GAE Modules and Google Endpoints

纵然是瞬间 提交于 2019-12-11 05:29:56

问题


I'm migrating a GAE application to modules, and have issues with the routing for my api module, based on Google Endpoints.

Basically, all my API queries are routed to the default module, while other routing works well

My folder structure is

- /gae
-- dispatch.yaml
-- www/
---- www.yaml
---- [www module files]
-- foo/
---- foo.yaml
---- [foo module files]
-- api/api.yaml
---- api.yaml
---- [foo module files]

dispatch.yaml

application: testapp

dispatch:
  - url: "testapp.appspot.com/"
    module: default
  - url: "*/_ah/spi/*"
    module: api
  - url: "*/_ah/api/*"
    module: api
  - url: "*/foo/*"
    module: foomodule        

I'm deploying with

cd gae
appcfg.py update www/www.yaml upload/upload.yaml api/api.yaml
appcfg.py update_dispatch .

I can see 3 instances (one per module) being deployed.

But then:

  • queries such as http://testapp.appspot.com/xxx are correctly routed to the default module/instance
  • /foo/xxx ones are handled by the foomodule
  • API requests (/_ah/spi/xxx) are going to the default module with a 404.
  • Strangely, when starting the app, I can see a 200 OK for /_ah/spi/BackendService.logMessages in the logs of the api instance.

From the logs I also see that:

  • The previous logMessage 200 OK comes from alpha-dot-api-dot-testapp.appspot.com
  • The 404 for the api module are from testapp.appspot.com
  • Yet, the 200 OK for non-default modules are also from ``testapp.appspot.com`

Is there anything that I'm doing wrong? Any special routing needed for Google Endpoints when they're used as modules?


回答1:


As i see the API is the default module, in the docs say "the default module must be uploaded first" also you need put the parameter "module: default" in the yaml file or not included at all Try

appcfg.py update  api/api.yaml www/www.yaml upload/upload.yaml #api first
appcfg.py update_dispatch


来源:https://stackoverflow.com/questions/24135252/gae-modules-and-google-endpoints

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!