4

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?

Geob
  • 586
  • 5
  • 15
  • If the Firebase CLI doesn't work the way you expect, contact Firebase support directly with a bug report. There's not much Stack Overflow can do to help. https://support.google.com/firebase/contact/support – Doug Stevenson Jul 16 '19 at 15:40

3 Answers3

2

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

Paul Rumkin
  • 6,737
  • 2
  • 25
  • 35
Grog
  • 21
  • 1
  • 3
1

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

1

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.

Vagner Gon
  • 595
  • 9
  • 23