'TypeError: app.firestore is not a function when running firebase serve
I am trying to run an Angular project with SSR but after build, when I run
firebase serve
I see this:
hosting: Local server: http://localhost:5000 functions[ngssr]: http function initialized (http://localhost:5001/angularssrproject-94bc1/us-central1/ngssr). i functions: Beginning execution of "ngssr" ERROR Error: Uncaught (in promise): TypeError: app.firestore is not a function TypeError: app.firestore is not a function at /home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:4655492 at ZoneDelegate.invoke (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1583709) at Zone.run (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1576123) at NgZone.runOutsideAngular (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:2069697) at /home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:4655466 at ɵfetchInstance (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:3541186) at new angular_fire_firestore_AngularFirestore (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:4655394) at Object.AngularFirestore_Factory [as factory] (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:4657481) at R3Injector.hydrate (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1850282) at R3Injector.get (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1847301) at resolvePromise (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1594029) at resolvePromise (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1592968) at /home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1595621 at ZoneDelegate.invokeTask (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1584641) at Object.onInvokeTask (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:2068145) at ZoneDelegate.invokeTask (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1584531) at Zone.runTask (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1577206) at drainMicroTaskQueue (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1588249) at ZoneTask.invokeTask (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1586290) at Server.ZoneTask.options.useG.invoke (/home/podarrazvan/Documents/Proiecte/Web/video-sharing-frontend/functions/lib/server/main.js:1:1586055) { rejection: TypeError: app.firestore is not a function
I added this in angular.json:
"externalDependencies": [
"@firebase/firestore",
"@nestjs/microservices",
"@nestjs/microservices/microservices-module",
"@nestjs/websockets",
"@nestjs/websockets/socket-module",
"cache-manager"
]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
