问题
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 theapi
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 fromtestapp.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