angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.74k stars 11.98k forks source link

Firestore onSnapshot causes prerender to stuck #25724

Closed 10eputzen closed 10 months ago

10eputzen commented 1 year ago

🐞 Bug report

What modules are related to this issue?

Is this a regression?

I do not know

Description

The onSnapshot (from firebase documentation) causes npm run prerender to get stuck when using the regular builder in angular.json

    "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",

while generating the routes.

const unsubscribe = onSnapshot(q, (querySnapshot) => {
  const cities = [];
  querySnapshot.forEach((doc) => {
      cities.push(doc.data().name);
  });
  console.log("Current cities in CA: ", cities.join(", "));
});

When using esbuild - it works fine.

      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser-esbuild",

πŸ”¬ Minimal Reproduction

Here is my Bug Repo. You need to have a firestore config pasted into the environment.ts https://github.com/10eputzen/angularBugRepo/tree/bug/angularUniversal

πŸ”₯ Exception or Error

Unfortunately there is no error - the prerendering is stuck here: Prerendering 1 route(s) to /angularBugRepo/dist/angularBugRepo/browser...

I am getting this error as well, but I also get it with esbuild and everyhting works fine with dev:ssr Unable to extract routes from application.

🌍 Your Environment


@angular-devkit/architect       0.1602.0
@angular-devkit/build-angular   16.2.0
@angular-devkit/core            16.2.0
@angular-devkit/schematics      16.2.0
@angular/cli                    16.2.0
@nguniversal/builders           16.2.0
@nguniversal/express-engine     16.2.0
@schematics/angular             16.2.0
rxjs                            7.8.1
typescript                      5.1.6
zone.js                         0.13.1

NsovoBaloyi commented 1 year ago

Having the same issue, but not related to firebase. I'm however not sure how to reproduce the issue as it works sometimes.

10eputzen commented 1 year ago

Having the same issue, but not related to firebase. I'm however not sure how to reproduce the issue as it works sometimes.

Does switching the builder to browser-esbuild help?

NsovoBaloyi commented 1 year ago

Having the same issue, but not related to firebase. I'm however not sure how to reproduce the issue as it works sometimes.

Does switching the builder to browser-esbuild help?

It seems to work with browser-esbuild, however, I can't use browser-esbuild yet

alan-agius4 commented 10 months ago

@10eputzen, Is this still an issue with version 17? In the case it is can you please update the reproduction to reproduce the exact error without us having to setup firebase?

Thanks.

alan-agius4 commented 10 months ago

Closing as no further feedback was provided.

angular-automatic-lock-bot[bot] commented 9 months ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.