Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: functions.pubsub.schedule is not a function

Tags:

firebase

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)
like image 706
alacret Avatar asked Nov 08 '25 03:11

alacret


1 Answers

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.

like image 63
Vipul Kumar Baloda Avatar answered Nov 11 '25 14:11

Vipul Kumar Baloda



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!