Question

I have configured Google App Engine to record exception with ereporter.

The cron job is configured to run every 59 minutes. The cron.yaml is as follows

cron:
- description: Daily exception report
  url: /_ereporter?sender=xxx.xxx@gmail.com  # The sender must be an app admin.
  schedule: every 59 minutes

How to do I run this immediately.

What I am trying to do here is simulate a 500 HTTP error and see the stack trace delivered immediately via the cron job.

Was it helpful?

Solution

Just go to the URL from your browser.

OTHER TIPS

You can't using cron. Cron is a scheduling system, you could get it to run every minute.

Alternately you could wrap your entire handler in a try/except block and try to catch everything. (You can do this for some DeadlineExceededErrors for instance) then fire off a task which invokes ereporter handler, and then re-raise the Exception.

However in many cases Google infrastructure can be the cause of the Error 500 and you won't be able to catch the error. To be honest you are only likely to be able to cause an email sent for a subset of all possible Error 500's. The most reliable way probably be to have a process continuously monitor the logs, and email from there.

Mind you email isn't consider reliable or fast so a 1 min cron cycle is probably fast enough.

I came across this thread as I was trying to do this as well. A (hacky) solution I found was to add a curl command at the end of my cloudbuild.yaml file that triggers the file immediately per this thread. Hope this helps!

Make a curl request in Cloud Build CI/CD pipeline

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top