Repository navigation
Open
Labels
P2The issue is important to a large percentage of users, with a workaroundarea: serverIssues related to server-side renderingeffort2: daysfreq2: mediumtype: bug/fix
Milestone
Description
🐞 bug report
Affected Package
@angular/platform-server
Is this a regression?
No, I tested a v4 and v6 and the behavior is consistent
Description
renderModuleFactory does not reject for errors thrown during rendering.
Examples:
@ComponentngOnInit- Router
resolve - Probably more
🔬 Minimal Reproduction
npm i && npm run prerender🔥 Exception or Error
jason@pop-os ~/projects/temp/temp/angular-bugs render-module-factory npm run prerender
> [email protected] prerender /home/jason/projects/temp/temp/angular-bugs
> ng build && ng run ng8-app:server && node ./main.js
Generating ES5 bundles for differential loading...
ES5 bundle generation complete.
chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 10.1 kB [initial] [rendered]
chunk {styles} styles-es5.js, styles-es5.js.map (styles) 14.2 kB [initial] [rendered]
chunk {main} main-es2015.js, main-es2015.js.map (main) 48.2 kB [initial] [rendered]
chunk {main} main-es5.js, main-es5.js.map (main) 55.3 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 789 kB [initial] [rendered]
chunk {vendor} vendor-es2015.js, vendor-es2015.js.map (vendor) 3.75 MB [initial] [rendered]
chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 5.21 MB [initial] [rendered]
chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 264 kB [initial] [rendered]
Date: 2019-11-07T04:43:04.373Z - Hash: c69b66b49129c074781b - Time: 13236ms
Hash: 2a979d82dfc31ad8eb0a
Time: 2896ms
Built at: 11/06/2019 11:43:08 PM
Asset Size Chunks Chunk Names
main.js 65 KiB main [emitted] main
main.js.map 36.2 KiB main [emitted] main
Entrypoint main = main.js main.js.map
chunk {main} main.js, main.js.map (main) 54.8 KiB [entry] [rendered]
ERROR Error: hi
at AppComponent.ngOnInit (/home/jason/projects/temp/temp/angular-bugs/dist/ng8-app-server/main.js:233:15)
at checkAndUpdateDirectiveInline (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:21240:23)
at checkAndUpdateNodeInline (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:29610:24)
at checkAndUpdateNode (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:29572:20)
at prodCheckAndUpdateNode (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:30113:9)
at Object.updateDirectives (/home/jason/projects/temp/temp/angular-bugs/dist/ng8-app-server/main.js:187:264)
at Object.updateDirectives (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:29901:76)
at Object.checkAndUpdateView (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:29554:18)
at ViewRef_.detectChanges (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:20829:26)
at ApplicationRef.tick (/home/jason/projects/temp/temp/angular-bugs/node_modules/@angular/core/bundles/core.umd.js:27224:30)
promise resolved
jason@pop-os ~/projects/temp/temp/angular-bugs render-module-factory
🌍 Your Environment
Angular Version:
✘ jason@pop-os ~/projects/temp/fs-datatable master ng v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.3.1
Node: 10.16.3
OS: linux x64
Angular: 7.2.15
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.13.9
@angular-devkit/build-angular 0.13.9
@angular-devkit/build-optimizer 0.13.9
@angular-devkit/build-webpack 0.13.9
@angular-devkit/core 7.3.9
@angular-devkit/schematics 7.3.1
@angular/cdk 7.3.7
@angular/cli 7.3.1
@angular/material 7.3.7
@ngtools/webpack 7.3.9
@schematics/angular 7.3.1
@schematics/update 0.13.1
rxjs 6.3.3
typescript 3.2.2
webpack 4.29.0
Reacted by Krzysztof Platis, Paweł Fraś, Artem Zur and LanderBeeuwsaert
Reacted by LanderBeeuwsaert
Metadata
Metadata
Assignees
Labels
P2The issue is important to a large percentage of users, with a workaroundarea: serverIssues related to server-side renderingeffort2: daysfreq2: mediumtype: bug/fix
Activity
FrozenPandaz commentedon Nov 7, 2019
cc @vikerman
23 remaining items
webberig commentedon Dec 2, 2025
I ended up here while investigating an issue on our production website. A page was returning a 200 OK response in a corrupted state. I noticed that the
ng-statewas missing in the response.The server logs mentioned following error:
Due to an application error, there was an unserializable object being put in the transferstate object. This caused the error above. Unfortunately, the error is being swallowed so the page returns a 200 OK without the transferstate object, which in turn caused some issues for our website client-side.
The code containing the error handling is here:
angular/packages/platform-server/src/utils.ts
Line 207 in f35b2ef
Ideally we have a way of handling this kind of error and produce an error page instead.
alan-agius4 commentedon Dec 2, 2025
@webberig, your issue seems something slightly different from the original issue. Do you mind opening an new issue? Thanks.
zola-dev commentedon Jul 7, 2026
Our report (angular/angular-cli#33522) was closed as a duplicate of this issue. It is on the current pipeline: @angular/build prerendering with @angular/ssr on v22, where renderModuleFactory (this issue's title) no longer exists.
The outcome is the same as described here:
a component render error is routed to the default ErrorHandler during ApplicationRef.tick and only logged, whenStable() resolves after it, and the build exits 0 shipping the degraded page.
We opened it as a separate issue following the suggestion in this thread (Dec 2025) to open a new one for a related report:
#33642 (comment)
It has a fresh v22 reproduction and a proposed mechanism (exposing rethrowApplicationErrors, which TestBed already has, for server/prerender rendering).
Could the new report be reopened as its own tracker for the current pipeline? If this issue is meant to cover it as well, glad to keep it here.
arturovt commentedon Sep 29, 2026
@JeanMeche this can be closed. renderModuleFactory no longer exists: platform-server exports renderApplication and renderModule now, so the reported API cannot be tested.
The behavior is also the ErrorHandler contract rather than a rendering bug. An error thrown in ngOnInit goes to the error handler, which logs it and lets rendering continue, exactly as it does in the browser. A prerender pipeline that wants to fail on those can provide its own ErrorHandler and reject from there.
P2 since 2019 against 7.2.15, assigned to @alan-agius4 but never started, no duplicates. If it still matters for prerendering on a current version, that belongs in the CLI repo where the pipeline lives.