Firebase: Error parsing triggers: Cannot find module 'request-promise' simple cloud function
If you want to use an npm module in your Cloud Function, cd
to the functions directory and run the command npm install request-promise
or whatever the module is named. This will add the module to your package.json file. Then, when you run firebase deploy
, the module will be available to your code running in Google's cloud. If you try to use a module that's not listed in package.json, your code will fail.
I had the same issue and fixed it installing both, request and request-promise. Go to the directory where your functions live and execute:
npm install --save request request-promise
The --save will take care of updating your package.json. Then redeploy and it should work.
Its not able to find request-promise because it is not installed. It is separate from firebase so you need to add it to your package.json. I would also add the request library.
Add the below two lines in your dependencies and run an npm install.
"request": "^2.x",
"request-promise": "^1.x"