Getting this problem deploying a scheduled function on firebase:
Error: Error occurred while parsing your function triggers.
TypeError: functions.pubsub.schedule is not a function
at Object.<anonymous> (/Users/alacret/workspace/kadem-functions/functions/index.js:12:46)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at /usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:15:15
at Object.<anonymous> (/usr/local/lib/node_modules/firebase-tools/lib/triggerParser.js:53:3)
The key seems to be using the right firebase-functions pkg version with respect to the node version used. In my case, I was using node 18 (older version at that time) and firebase-functions:6.0.1 (latest at that time). This was giving the OP's error
'TypeError: functions.pubsub.schedule is not a function'.
I changed firebase-functions version to 5.1.1 (older version) and it worked perfectly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With