Search code examples
google-app-enginegae-module

dispatch.yaml not working for task queue when defaulting production environment


I started teasing apart an app into two modules and successfully have the app running on App Engine. I can verify the new configuration by using the module/version specific URLs to drive traffic and see requests and task queue events processed without error.

For example, using - http://micro-services.msn-transit-api.appspot.com - correctly drives traffic to the new, non-default version.

However, when I update the default version in the GAE console, requests that should be dispatched to a new module are not routing correctly. They are dispatched to the default module and fail since the endpoints have moved.

It's as if dispatch.yaml isn't activated.

Default App yaml file :

application: msn-transit-api
module: default
version: micro-services
runtime: python27
api_version: 1
threadsafe: true
instance_class: F1
automatic_scaling:
  min_idle_instances: 3

New module yaml file :

application: msn-transit-api
module: stats-and-maps
version: micro-services
runtime: python27
api_version: 1
threadsafe: true
instance_class: B1
basic_scaling:
  max_instances: 1

handlers:

# map apps
- url: /map(.*)
  script: stats_and_maps.maps.map.app

# stats task
- url: /stats/new/.*
  script: stats_and_maps.stats.stathat.application

Dispatch yaml :

dispatch:
  - url: "*/map*"
    module: stats-and-maps

  - url: "*/stats/*"
    module: stats-and-maps

It's worth noting that the endpoints that are failing are getting hit by jobs in the Task Queue.

Why would defaulting the version on GAE change its behavior?


Solution

  • Found it buried in the Task Queue documentation. :(

    Queues have a "target" configuration directive. The documentation has this nugget :

    If target is unspecified, then tasks are invoked on the same version of the application where they were enqueued

    I believe they are using "version" and "module" interchangeably in this context.

    This also allows me to do away with the dispatch.yaml file for those routes!