-
Notifications
You must be signed in to change notification settings - Fork 11.9k
Description
Which @angular/* package(s) are the source of the bug?
core
Is this a regression?
No
Description
I tried to build my app with following setting, I have ~20k urls to build. and because all requests are sent concurrently from the build process, the api is taking time to process all these concurrent requests.
{
...
"prerender":{
"routesFile": "prerender-urls.txt",
"discoverRoutes": false
},
"ssr": false
...
}
because of this delay, the page is taking more time to response than Agular build process waits and it fails with timeout error.
I did my research and opened a stackoverflow issue after I couldn't find any proper solution to this. I see other people facing the same problem. so opening this issue.
Please provide a link to a minimal reproduction of the bug
create a new app with 1 component, enable prerender with few diff parameter urls that needs backend api calls, api should simulate a delay in response about 5 min or more to make it happen fast, build angular app and wait until the build throws a timeout error.
Please provide the exception or error you saw
Prerendered 3 static routes.
Application bundle generation failed. [133.998 seconds]
X [ERROR] An error occurred while prerendering route '/jumbo'.
AbortError: Request for: http://ng-localhost/pens was aborted.
TimeoutError: The operation was aborted due to timeout
at e.signal.addEventListener.once (file:///D:/Frontend/.angular/prerender-root/bb5c5a0f-dd0d-4247-9895-f97bd3bef5b1/main.server.mjs:74:4998)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
at EventTarget.dispatchEvent (node:internal/event_target:755:26)
at abortSignal (node:internal/abort_controller:370:10)
at AbortController.abort (node:internal/abort_controller:392:5)
at EventTarget.abort (node:internal/deps/undici/undici:5038:21)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
at EventTarget.dispatchEvent (node:internal/event_target:755:26)
at abortSignal (node:internal/abort_controller:370:10)
at Timeout._onTimeout (node:internal/abort_controller:127:7)
X [ERROR] An error occurred while prerendering route '/'.
Error: Terminating worker thread
at ThreadPool.destroy (D:\Frontend\node_modules\piscina\dist\index.js:428:27)
at WorkerPool.destroy (D:\Frontend\node_modules\piscina\dist\index.js:631:65)
at D:\Frontend\node_modules\@angular\build\src\utils\server-rendering\prerender.js:147:35
at async Promise.all (index 4)
at async renderPages (D:\Frontend\node_modules\@angular\build\src\utils\server-rendering\prerender.js:151:9)
at async prerenderPages (D:\Frontend\node_modules\@angular\build\src\utils\server-rendering\prerender.js:93:49)
at async executePostBundleSteps (D:\Frontend\node_modules\@angular\build\src\builders\application\execute-post-bundle.js:68:73)
at async executeBuild (D:\Frontend\node_modules\@angular\build\src\builders\application\execute-build.js:170:24)
at async watch (D:\Frontend\node_modules\@angular\build\src\builders\application\index.js:70:24)
at async Task.task [as taskFn] (D:\Frontend\node_modules\@angular\build\src\tools\esbuild\utils.js:140:26)
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 19.0.2
Node: 20.15.1
Package Manager: npm 10.7.0
OS: win32 x64
Angular: 19.0.1
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1900.2
@angular-devkit/build-angular 19.0.2
@angular-devkit/core 19.0.2
@angular-devkit/schematics 19.0.2
@angular/cli 19.0.2
@angular/ssr 19.0.2
@schematics/angular 19.0.2
rxjs 7.8.1
typescript 5.6.3
Anything else?
it would be helpful if there is a way either in angular or node rendering engine to set a value for wait period before throwing a timeout error.
I believe this is one of the most common scenarios that many people are and will face it while using SSG with large amount of pages and slow apis.
thanks