Search code examples
google-app-enginegoogle-cloud-platformcrongcloudgoogle-cloud-scheduler

App Engine Cron Job Does Not Show Up After Uploading


I followed the guide to create and upload a cron job for my GAE project. It looks like it works but does not show up in Cloud Scheduler. Here's the output when I run gcloud app deploy cron.yaml:

Configurations to update:

descriptor:      [/Users/me/Projects/org/prj-name/cron.yaml]
type:            [cron jobs]
target project:  [GCP-PROJECT-ID]


Do you want to continue (Y/n)?  y

Updating config [cron]...⠹WARNING: We are using the App Engine app location (us-east1) as the default location. Please use the "--location" flag if you want to use a different location.
Updating config [cron]...⠶WARNING: We are using the App Engine app location (us-east1) as the default location. Please use the "--location" flag if you want to use a different location.
Updating config [cron]...done.                                                               

Cron jobs have been updated.

Visit the Cloud Platform Console Task Queues page to view your queues and cron jobs.
https://console.cloud.google.com/appengine/taskqueues/cron?project=GCP-PROJECT-ID

The status code of that command is 0 and everything looks like it worked. However, if I then run gcloud scheduler jobs list, I get:

WARNING: We are using the App Engine app location (us-east1) as the default location. Please use the "--location" flag if you want to use a different location.
Listed 0 items.

I confirmed I have the latest gcloud version:

$ gcloud --version
Google Cloud SDK 421.0.0
bq 2.0.87
core 2023.03.03
gsutil 5.21

$ gcloud app update
Nothing to update.

Not sure if it's me but I tried simply copying and pasting the cron.yaml directly from the guide and even that didn't work, so I don't think so.


Solution

  • Ok figured it out. This is a case of terrible documentation and PEBKAC. There are 2 types of scheduled jobs:

    1. App engine cron jobs
    2. Cloud Scheduler jobs

    The documentation I linked above tells you how to create type #1, app engine cron jobs. It then gives you a link, which directs you to "Manage your Cron jobs in Cloud Scheduler". This goes to jobs of type 2. There's another tab on that page to look at type 1 jobs however. Furthermore, from what I see, there's no gcloud app command to list jobs of type 1.

    tl;dr: I was creating app engine cron jobs (#1) but then listing cloud scheduler jobs (#2) so of course there were none.