angular / angularfire

Angular + Firebase = ❤️
https://firebaseopensource.com/projects/angular/angularfire2
MIT License
7.67k stars 2.19k forks source link

AngularFirestoreModule causes Angular Server Side Rendering to fail. #2129

Closed SauceCode84 closed 3 years ago

SauceCode84 commented 5 years ago

Version info

Angular: v8.1

Firebase: v6.3

AngularFire: v5.2.1

Other (e.g. Ionic/Cordova, Node, browser, operating system):

How to reproduce these conditions

Adding AngularFirestoreModule to the project causes Angular Server Side Rendering to fail when running the serve command, i.e. npm run build:ssr - after the build. It fails with the same error when running firebase serve or firebase deploy.

When the AngularFirestoreModule is removed from the application, however, the build and serve work.

Debug output

> fip-fight-club@0.0.0 serve:ssr /home/richard/Code/fip-fight-club
> node dist/server

/home/richard/Code/fip-fight-club/dist/server/main.js:180715
        throw new Error("package.json does not exist at " + package_json_path);
        ^

Error: package.json does not exist at /home/richard/Code/fip-fight-club/dist/package.json
    at Object.PsoT.exports.find (/home/richard/Code/fip-fight-club/dist/server/main.js:180715:15)
    at Object.wPNL (/home/richard/Code/fip-fight-club/dist/server/main.js:256777:12)
    at __webpack_require__ (/home/richard/Code/fip-fight-club/dist/server/main.js:20:30)
    at Object.XpdW (/home/richard/Code/fip-fight-club/dist/server/main.js:197412:12)
    at __webpack_require__ (/home/richard/Code/fip-fight-club/dist/server/main.js:20:30)
    at Object.g1pB (/home/richard/Code/fip-fight-club/dist/server/main.js:214495:27)
    at __webpack_require__ (/home/richard/Code/fip-fight-club/dist/server/main.js:20:30)
    at Object.Ou8q (/home/richard/Code/fip-fight-club/dist/server/main.js:177412:14)
    at __webpack_require__ (/home/richard/Code/fip-fight-club/dist/server/main.js:20:30)
    at Object.BYZf (/home/richard/Code/fip-fight-club/dist/server/main.js:31994:12)

Expected behavior

Serve or deploy the application with Server Side Rendering functionality.

Actual behavior

Error in the console, as per above.

jlmonteagudo commented 5 years ago

I'm also fighting against this problem.

Does anyone have a clue? :)

WUKS87 commented 5 years ago

@jlmonteagudo No solution for now. Please share this issue

matheo commented 5 years ago

Use v5.1.3, see #2115

marcjal commented 4 years ago

The same problem here I'm using:

Angular: v8.2 Firebase: v7.3 AngularFire: v5.2.1

WUKS87 commented 4 years ago

@marcjal Have you tried Angularfire v5.1.3?

marcjal commented 4 years ago

@WUKS87 Let me see that version I hadn’t tried yet. Thanks

jamesdaniels commented 3 years ago

Closing as outdated.