Hi
A few months ago I did a few Cloud function in TypeScript using Webpack. Was working just fine.
I've put this aside and now coming back to the project. Now, these cloud functions are no longer working.
Seem that Firebase added a new TypeScript option to create cloud functions.
I've downloaded the sample and followed the steps from this site.
First "npm run deploy" work fine.
I add another function without any really code in the function and run and deploy just fine.
At the moment I add:
import * as admin from 'firebase-admin';
admin.initializeApp(functions.config().firebase);
and try to run and deploy, i get errors. Even if I remove these lines now I'm stock in an endless error. So I can no longer run and deploy.
Here is the error.
node_modules/firebase-functions/lib/providers/firestore.d.ts(17,29): error TS2694: Namespace 'admin.firestore' has no exported member 'DocumentReference'.
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! functions@ build: tsc
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the functions@ build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BenoitAppData\Roaming\npm-cache_logs\2018-03-22T14_08_58_788Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code2
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! functions@ deploy: firebase deploy --only functions
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the functions@ deploy script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BenoitAppData\Roaming\npm-cache_logs\2018-03-22T14_08_59_419Z-debug.log
Any idea what is the cause?
Thank you
npm install firebase-functions@latest firebase-admin@latest --save inside your functions folder
The biggest issue with this answer right now @Alb93 is that.
[email protected] requires a peer of firebase-admin@~5.10.0 but none is installed. You must install peer dependencies yourself.
Hi Everyone.
I re-installed the latest version and did some small source change and now it's working.
Thank you
Most helpful comment
npm install firebase-functions@latest firebase-admin@latest --save inside your functions folder