Geob
Geob

Reputation: 596

Related Scheduler Job not created-Firebase Scheduled Function

I have written a scheduled function in node.js using typescript that successfully deploys.The related pub/sub topic gets created automatically but somehow the related scheduler job does not.

This is even after getting these lines

i  scheduler: ensuring necessary APIs are enabled...
i  pubsub: ensuring necessary APIs are enabled...
+  scheduler: all necessary APIs are enabled
+  pubsub: all necessary APIs are enabled
+  functions: created scheduler job firebase-schedule-myFunction-us-central1
+  functions[myFunction(us-central1)]: Successful create operation.

+  Deploy complete!

I have cloned the sample at https://github.com/firebase/functions-samples/tree/master/delete-unused-accounts-cron which deploys and automatically creates both the related pub/sub topic and scheduler job.

What could i be missing?

Upvotes: 4

Views: 355

Answers (3)

Vagner Gon
Vagner Gon

Reputation: 645

Maybe your cron syntax isn't correct. There are some tools to validate the syntax

Check your firebase-debug.log

At some point,it will invoke a POST request to:

>> HTTP REQUEST POST https://cloudscheduler.googleapis.com/v1beta1/projects/*project_name*/locations/*location*/jobs  

This must be a 200 response.

Upvotes: 1

Grog
Grog

Reputation: 21

Try to change .timeZone('utc') (per the docs) to .timeZone('Etc/UTC') (also per the self-contradictory docs).

Upvotes: 2

user1919007
user1919007

Reputation: 11

It seems that when using the 'every 5 minutes' syntax, the deploy does not create the scheduler job.

Switching to the cron syntax solved the problem for me

Upvotes: 1

Related Questions