8
votes

I created a Google Cloud function that gets data and dumps it into a Google SQL Database. I need this function to execute every 15 minutes. As I understand it you cannot execute cloud functions in a cron job. The workaround is to deploy an app in the App engine.

I've deployed a simple NodeJS application that makes an http request using the NodeJS https module. I've deployed this app to Google App Engine along with the following cron.yaml

cron:
- description: "Gets new data every 15 minutes"
  url: /
  schedule: every 15 mins

But this is not executing and it is not showing up in the cron jobs list. Does the above cron job syntax look correct?

Is there anything else I need to do to get Google App Engine to pick up this cron job?

tyia

1
If the cron job doesn't show up in the cron jobs list it means it wasn't actually deployed. How did you deploy it?Dan Cornilescu
I have all the files, index.js, package.json, app.yaml, and cron.yaml all in the same folder. I am deploying all of them using gcloud app deploy from inside that directoryuser316114

1 Answers

28
votes

I had mistakingly thought that cron.yaml would be deployed as a cron job when I executed gcloud app deploy

To deploy the cron job I had to explicitly deploy cron.yaml

gcloud app deploy cron.yaml