Skip to content

Angular 16 SSR not retrieving data from http request #50562

@echotech11

Description

@echotech11

🐞 Bug report

What modules are related to this issue?

  • builders
  • common
  • express-engine

Is this a regression?

Yes, the previous version in which this bug was not present was: angular 15.2.0
this repo shows that it was working in a15: https://github.com/echotech11/ssr-problem-15

Description

In a new angular 16 app I have found that SSR will not retrieve data in any component other than the app component.

🔬 Minimal Reproduction

I have provided a minimum repo to show the issue. I generated this project with ng new then added ssr ng add @nguniversal/express-engine and added the needed code to reproduce the issue.
https://github.com/echotech11/ssr-problem
steps to reproduce:

  1. git clone https://github.com/echotech11/ssr-problem
  2. npm ci
  3. npm run dev:ssr
  4. navigate to http://localhost:4200
  5. CTRL+U in browser will show SSR retrieved the data.
  6. Comment out line 3 in app.component.html
  7. navigate to http://localhost:4200/test
  8. CTRL+U in browser will show SSR did not retrieve the data.

I have also made the same repo in angular 15 where SSR is working correctly using basically the same code.
https://github.com/echotech11/ssr-problem-15

🔥 Exception or Error

No errors

🌍 Your Environment


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

Angular CLI: 16.0.4
Node: 18.16.0
Package Manager: npm 9.5.1
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1600.4
@angular-devkit/build-angular   16.0.4
@angular-devkit/core            16.0.4
@angular-devkit/schematics      16.0.4
@nguniversal/builders           16.0.2
@nguniversal/express-engine     16.0.2
@schematics/angular             16.0.4
rxjs                            7.8.1
typescript                      5.0.4

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