Skip to content

HTTP calls seem to hang server side only #50405

@CarlosTorrecillas

Description

@CarlosTorrecillas

🐞 Bug report

What modules are related to this issue?

  • builders
  • common
  • express-engine

Is this a regression?

I think this is a regression compared to the previous version I got installed which was 15.2.7

Description

HTTP calls seem to get stuck and do not finish serverside when they go out externally (to a real API).

🔬 Minimal Reproduction

1.- Download the finished example that is available in the Angular site: https://angular.io/guide/universal which is the tour of heroes
2.- Go to the app.module.ts and comment out the HttpClientInMemoryWebApiModule so that it simulates that there is a real HTTP call.
3.- Run the code using npm run dev:ssr for example
4.- Navigate to http://localhost:4200/dashboard
5.- See in the page that you have the Messages, the clear button and there is one message saying: HeroService: getHeroes failed: Http failure response for http://localhost:4200/api/heroes: 404 Not Found
6.- Right click on the page and click on View Page Source and see that all static code that needs to be rendered pre-HTTP call gets rendered on the page such as the Tour of Heroes, the Dashboard tab or the heroes tab is rendered however things like the Messages section (H2) or the actual message itself is not.

🔥 Exception or Error

I can see the following error in logs of the server

NetworkError
    at send (./node_modules/xhr2/lib/xhr2.js:281:19)
    at observer (./node_modules/@angular/common/fesm2022/http.mjs:1969:21)
    at _trySubscribe (./node_modules/rxjs/dist/cjs/internal/Observable.js:41:25)
    at cb (./node_modules/rxjs/dist/cjs/internal/Observable.js:35:31)
    at errorContext (./node_modules/rxjs/dist/cjs/internal/util/errorContext.js:22:9)
    at subscribe (./node_modules/rxjs/dist/cjs/internal/Observable.js:26:24)
    at onNext (./node_modules/rxjs/dist/cjs/internal/operators/switchMap.js:17:63)
    at _next (./node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:33:21)
    at next (./node_modules/rxjs/dist/cjs/internal/Subscriber.js:51:18)
    at <anonymous> (./node_modules/rxjs/dist/cjs/internal/observable/innerFrom.js:120:28)

However although the error (I am not sure) is related to a real 404, that should be handled in the application and the message should be rendered.

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 16.0.2
Node: 18.10.0
Package Manager: npm 8.19.2
OS: win32 x64

Angular: 16.0.2
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.2
@angular-devkit/build-angular   16.0.2
@angular-devkit/core            16.0.2
@angular-devkit/schematics      16.0.2
@nguniversal/builders           16.0.2
@nguniversal/express-engine     16.0.2
@schematics/angular             16.0.2
rxjs                            7.8.1
typescript                      4.9.5

Metadata

Metadata

Assignees

Labels

area: serverIssues related to server-side renderingregressionIndicates than the issue relates to something that worked in a previous version

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions