firebase-tools:
7.0.0
Platform:
Ubuntu 18.04
NodeJS 8
npm 6.4.1
Trying to use https://github.com/google/voice-builder and stuck at ./deploy.sh cloud_functions this step.
i deploying functions
i functions: ensuring necessary APIs are enabled...
✔ functions: all necessary APIs are enabled
i functions: preparing functions directory for uploading...
Error: Error occurred while parsing your function triggers.
TypeError: require(...) is not a function
at Object.<anonymous> (/tmp/tmp.qkavb63yp9/functions/index.js:21:45)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at /usr/lib/node_modules/firebase-tools/lib/triggerParser.js:15:15
at Object.<anonymous> (/usr/lib/node_modules/firebase-tools/lib/triggerParser.js:53:3)
This issue does not seem to follow the issue template. Make sure you provide all the required information.
@mirfan899 it looks like you're trying to deploy this file:
https://github.com/google/voice-builder/blob/master/cloud_functions/functions/index.js#L20
The error comes from this line:
const gcs = require('@google-cloud/storage')();
So export of the module '@google-cloud/storage' is not a function (you can see it's being invoked with ()).
It looks like that library (at least at the latest 2.x version) no longer has an import like that:
https://www.npmjs.com/package/@google-cloud/storage
Could you try changing the source const gcs = ... to const { gcs } = ... and see if that works for you?
Also I am going to close this issue since I am confident it is an issue with the "voice-builder" sample and not with the Firebase CLI but please let me know if the suggestion works for you!
Most helpful comment
@mirfan899 it looks like you're trying to deploy this file:
https://github.com/google/voice-builder/blob/master/cloud_functions/functions/index.js#L20
The error comes from this line:
So export of the module
'@google-cloud/storage'is not a function (you can see it's being invoked with()).It looks like that library (at least at the latest 2.x version) no longer has an import like that:
https://www.npmjs.com/package/@google-cloud/storage
Could you try changing the source
const gcs = ...toconst { gcs } = ...and see if that works for you?Also I am going to close this issue since I am confident it is an issue with the "voice-builder" sample and not with the Firebase CLI but please let me know if the suggestion works for you!