angular-universal-firebase icon indicating copy to clipboard operation
angular-universal-firebase copied to clipboard

Firestore issues with Angular Universal and AngularFire2 on Firebase Functions

Open phpet opened this issue 7 years ago • 2 comments

Angular: 6.0.6

Firebase: 5.0.4

AngularFire: 5.0.0-rc.10

Other (e.g. Ionic/Cordova, Node, browser, operating system): OS: Windows 10 Node version: 8.11.2

Steps to set up and reproduce

Clone this repository: https://github.com/phpet/ssr

npm run build:ssr firebase deploy

Debug output

** Errors in the Firebase Functions logs **

Unhandled Promise rejection: Cannot read property 'firestore' of undefined ; Zone: <root> ; Task: Promise.then ; Value: TypeError: Cannot read property 'firestore' of undefined
    at new AngularFirestore (/user_code/node_modules/angularfire2/bundles/firestore.umd.js:148:29)
    at _createClass (/user_code/node_modules/@angular/core/bundles/core.umd.js:8204:20)
    at _createProviderInstance$1 (/user_code/node_modules/@angular/core/bundles/core.umd.js:8166:26)
    at resolveNgModuleDep (/user_code/node_modules/@angular/core/bundles/core.umd.js:8129:21)
    at NgModuleRef_.get (/user_code/node_modules/@angular/core/bundles/core.umd.js:8837:16)
    at resolveDep (/user_code/node_modules/@angular/core/bundles/core.umd.js:9202:45)
    at createClass (/user_code/node_modules/@angular/core/bundles/core.umd.js:9076:85)
    at createDirectiveInstance (/user_code/node_modules/@angular/core/bundles/core.umd.js:8959:20)
    at createViewNodes (/user_code/node_modules/@angular/core/bundles/core.umd.js:10179:36)
    at createRootView (/user_code/node_modules/@angular/core/bundles/core.umd.js:10093:5) TypeError: Cannot read property 'firestore' of undefined
    at new AngularFirestore (/user_code/node_modules/angularfire2/bundles/firestore.umd.js:148:29)
    at _createClass (/user_code/node_modules/@angular/core/bundles/core.umd.js:8204:20)
    at _createProviderInstance$1 (/user_code/node_modules/@angular/core/bundles/core.umd.js:8166:26)
    at resolveNgModuleDep (/user_code/node_modules/@angular/core/bundles/core.umd.js:8129:21)
    at NgModuleRef_.get (/user_code/node_modules/@angular/core/bundles/core.umd.js:8837:16)
    at resolveDep (/user_code/node_modules/@angular/core/bundles/core.umd.js:9202:45)
    at createClass (/user_code/node_modules/@angular/core/bundles/core.umd.js:9076:85)
    at createDirectiveInstance (/user_code/node_modules/@angular/core/bundles/core.umd.js:8959:20)
    at createViewNodes (/user_code/node_modules/@angular/core/bundles/core.umd.js:10179:36)
    at createRootView (/user_code/node_modules/@angular/core/bundles/core.umd.js:10093:5)

** Screenshots **

https://imgur.com/5Ybcdw5

Expected behavior

Injecting the AngularFirestore variable in the constructor of the AppComponent class should work without errors.

Actual behavior

The browser shows a 504 Gateway Time-out error and the Firebase Functions logs show the error above.

I also tried with the latest version of AngularFire2 5.0.0-rc.11 and it doesn't work either.

Interesting facts

I tried replacing the angularfire2 library with angularfire-lite and it worked, so it's definitely related to the combination of AngularFire2 and Firestore.

phpet avatar Jun 23 '18 10:06 phpet

@phpet did you manage to get this github working? I cant seem to get it working with third party libraries?

calibri87 avatar Apr 04 '19 21:04 calibri87

PLEASE HELP!!! https://stackoverflow.com/questions/62646379/cant-deploy-angular-9-app-with-angular-universal-to-firebase-with-firebase-func

AnriTapel avatar Jul 25 '20 16:07 AnriTapel