0
votes

My cron jobs on Google App Engine stopped to work few days ago. It responds a 404 code. It's strange, because I didn't changed yaml files, and it was working properly.

Any help is appreciated. Thanks!

cron.yaml

cron:
- description: Push a "tick" onto pubsub every 5 minutes
  url: /publish/minutes-5-tick
  schedule: every 5 minutes

- description: Push a "tick" onto pubsub every hour
  url: /publish/hourly-tick
  schedule: every 1 hours

- description: Push a "tick" onto pubsub every hour
  url: /publish/hourly-tick-2
  schedule: every 1 hours

- description: Push a "tick" onto pubsub every day
  url: /publish/daily-tick
  schedule: every 24 hours

- description: Push a "tick" onto pubsub every week
  url: /publish/weekly-tick
  schedule: every saturday 00:00

app.yaml

runtime: python27
api_version: 1
threadsafe: true

handlers:

# Handler for the pubsub cron.
- url: /publish/.*
  script: main.app
  login: admin
  secure: always

- url: /.*
  script: main.app

libraries:
- name: webapp2
  version: latest
- name: pycrypto
  version: latest
- name: ssl
  version: latest

instance_class: F1

main.py


    class PushToPubSub(webapp2.RequestHandler):
        def get(self, topic):
            pubsub_utils.publish_to_topic(topic, str(time.time()))

            self.response.headers['Content-Type'] = 'application/json'
            self.response.write(json.dumps({"status": "200"}))

    app = webapp2.WSGIApplication([
        webapp2.Route(r'/publish/', handler=PushToPubSub)
    ], debug=True)

Log:

2
Where is your handler for this URL? Please show main.app url handling.GAEfan
@GAEfan Added main.py on original question. ThanksRodrigo Brauwers

2 Answers

1
votes

You don't have a url handler for /publish/hourly-tick. Try:

webapp2.Route(r'/publish/<topic:\w+>', handler=PushToPubSub),

That will send "hourly-tick" as the topic to be handled in PushToPubSub

0
votes