-
Notifications
You must be signed in to change notification settings - Fork 27k
Closed
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimearea: routerarea: serverIssues related to server-side renderingIssues related to server-side renderingarea: zonesIssues related to zone.jsIssues related to zone.jsregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous version
Milestone
Description
Which @angular/* package(s) are the source of the bug?
platform-server
Is this a regression?
Yes
Description
The node server built by nguniversal/express-engine crashes seems to be failing to handle errors correctly.
Reproduction
- ng add @nguniversal/express-engine
- Throw an error in any async function
export class AppComponent implements OnInit {
async ngOnInit() {
throw new Error('');
}
// or
ngOnInit() {
new Promise((_, reject) => reject(''));
}
}- Build and run the universal server (i.e.
npm run serve:ssr) - The node server crashes when it tries to run the code.
The same procedure the dependencies of Angular 15 does not crash the server.
Please provide the exception or error you saw
Node.js v18.16.0
A server error has occurred.
node exited with 1 code.
Please provide the environment you discovered this bug in (run ng version)
Angular CLI: 16.0.2
Node: 18.16.0
Package Manager: npm 9.5.1
OS: darwin arm64
Angular: 16.0.3
... animations, 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
@angular/cli 16.0.2
@nguniversal/builders 16.0.2
@nguniversal/express-engine 16.0.2
@schematics/angular 16.0.2
rxjs 7.8.1
typescript 5.0.4
Anything else?
ngOnInit() {
throw new Error('');
// or
throwError(() => '').subscribe();
}In case of "sync" function or an observble, the server does not crash and serves the html just fine.

Metadata
Metadata
Assignees
Labels
area: coreIssues related to the framework runtimeIssues related to the framework runtimearea: routerarea: serverIssues related to server-side renderingIssues related to server-side renderingarea: zonesIssues related to zone.jsIssues related to zone.jsregressionIndicates than the issue relates to something that worked in a previous versionIndicates than the issue relates to something that worked in a previous version