-
Notifications
You must be signed in to change notification settings - Fork 885
-
Notifications
You must be signed in to change notification settings - Fork 885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error Angular Universal running serve:ssr #2010
Comments
I have found that the firebase-js-sdk cannot be used with any/many ssr enabled frameworks. We have attempted to use it with Angular, Nextjs, and Fusion.js. |
@jlmonteagudo The error doesn't seem to come from firebase. The problem is that some code is looking for @puchesjr Firebase js sdk works with Angular (with SSR), though you might need to do some configuration depending on which firebase products are used. Many people are using Firebase with Angular SSR successfully today. Can you please open a new issue with your specific issue so we can track it and help other people with the similar issue? |
Hello @Feiyang1 Thank you for your interest. I already tried to copy package.json to that folder but I started to get new errors, so I couldn't solve the problem. I'm sure that there are a lot of projects working with Firebase and SSR, but I think that the last version of Angular and the last version of Firebase JS SDK are not working properly with SSR. In my previous message I wrote the steps to reproduce the problem, and as you can see, by default SSR is not working. |
I tried it (Angular SSR with Firebase) in a testing project, and it worked for me. |
Thank you very much for your help @Feiyang1 I have created the following repository: https://github.com/jlmonteagudo/angular-ssr I simply have followed the steps of my first message, and sadly it doesn't work for me. I usually work with the library angularfire2, and it was also failing, so, trying to find the problem, I deciced to test directly with Firebase JS SDK. |
Thanks for the repro! I'm able to reproduce the issue with it. To exclude If somehow you only want to exclude some external dependencies, you can take a look at the solution I posted in another thread. |
@Feiyang1 Hi. I am having the same issue and I changed the "build:client-and-server-bundles" command like you said but then when I try to rendering the app using npm run build:ssr && npm run serve:ssr if I go to localhost:4000 it keeps loading for a long time until it returns me an empty page with an error that saids "This page doesnt work". |
Thank you very much @Feiyang1 Now I don't receive any error. However, the content retrieved from Firebase is not being rendered in the server. In my web page, the final result is this: PLACES
But if I inspect the source code of the page, I get this:
In any case, I have used an alternative solution for my real app. I'm working with the Firebase REST API (with Firebase Real Time Database, because the JSON result of Firestore REST API is a bit weird for me). If I want to convert my app to a PWA, I think is more natural working with an REST API than with the Firebase SDK. Thank you for your help @Feiyang1 |
@jlmonteagudo You're welcome! Glad you found a solution that works for you. @nseverini We can't help you without any information. If you have any log trace, please open a new issue with that. |
Hello @Feiyang1 I'have tested it without async/await and it's not being rendered in the server. This is the code:
I have also tested it with AngularFire and it's being rendered properly in the server. This is what I get from the server:
Usually I work with AngularFire, but as I was facing problems then I decided to test only with Firebase JS SDK. Thank you very much for your help @Feiyang1 !! |
[REQUIRED] Describe your environment
[REQUIRED] Describe the problem
I've added firebase on a new Angular project and it works fine when I run ng serve. I can build the project for SSR without problem running the command npm run build:ssr. But when I run npm run serve:ssr I get the following error:
Steps to reproduce:
Relevant Code:
The text was updated successfully, but these errors were encountered: