Follow below link to setup google account for deploying your first serveless application. Google account setup
npm install -g serverless
npm install serverless-google-cronjobs
Update the credentials
and your project
property in the serverless.yml
file.
Update the plugin list in the serverless.yml
file.
plugins:
- serverless-google-cronjobs
Set schedule property in the your function's parameters
functions
hello:
handler: hello
events:
- event:
eventType: providers/cloud.pubsub/eventTypes/topic.publish
resource: 'projects/<projectId>/topics/<topicName>'
schedule: '* * * * *' # required
timeZone: 'UTC' # optional
target: pubsubTarget, appEngineHttpTarget or httpTarget # required
target