angular / angular/angular

renderModuleFactory does not reject when error is thrown in application

Đang mở
#33,642 12 bình luận 5 reaction 1 người được giao Được @alan-agius4 nhận Xem trên GitHub
area: server effort2: days freq2: medium P2 type: bug/fix
Ngôn ngữ chính
TypeScript
Star
101k
Fork
27.5k
Merge trung bình
1 ngày 19 giờ
Pull request đã merge (30 ngày)
288

Mô tả

# 🐞 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:

* `@Component` `ngOnInit`
* Router `resolve`
* Probably more

## 🔬 Minimal Reproduction

https://github.com/FrozenPandaz/angular-bugs/tree/render-module-factory

```bash
npm i && npm run prerender
```

## 🔥 Exception or Error

 jason@pop-os  ~/projects/temp/temp/angular-bugs   render-module-factory  npm run prerender

> ng8-app@0.0.0 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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.