Angular SSG Prerendering gives timeout when rendering big numb of urls (V17+)

Discussão em 'Angular' iniciado por Uttam Ughareja, Novembro 30, 2024.

  1. I have angular v19 app and I'm using SSG with following angular.json settings

    {
    ...
    "prerender":{

    "routesFile": "prerender-urls.txt",
    "discoverRoutes": false
    },
    "ssr": false
    ...
    }


    When I render a few routes it works, but when I try to render a big number of routes like 10K, the backend api is returning response slower.

    Because of that angular build pipeline is throwing an error timeout error like this

    Request for: http://ng-localhost/artists was aborted.
    TimeoutError: The operation was aborted due to timeout
    at t.signal.addEventListener.once (.angular/prerender-root/0e49d623-08ac-4921-af23-47b186294be5/chunk-4RSAFBPM.mjs:106:5215)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:825:20)
    at EventTarget.dispatchEvent (node:internal/event_target:760: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:825:20)
    at EventTarget.dispatchEvent (node:internal/event_target:760: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 '/artists'.

    Error: Terminating worker thread
    at Object.ThreadTermination (...piscina\dist\errors.js:5:30)
    at WorkerInfo.destroy (...piscina\dist\worker_pool\index.js:107:43)
    at ThreadPool._removeWorker (...piscina\dist\index.js:250:20)
    at ThreadPool.destroy (...piscina\dist\index.js:434:18)
    at WorkerPool.destroy (...piscina\dist\index.js:631:65)
    at ...@angular\build\src\utils\server-rendering\prerender.js:147:35
    at async Promise.all (index 151)
    at async renderPages (...@angular\build\src\utils\server-rendering\prerender.js:151:9)
    at async prerenderPages (...@angular\build\src\utils\server-rendering\prerender.js:93:49)
    at async executePostBundleSteps (...@angular\build\src\builders\application\execute-post-bundle.js:68:73)


    I researched and tried many workaround with no luck in finding a proper solution to increase this timeout issue.

    Is there any way to hijack Angular's build pipeline or other way to increase this timeout.

    this is a very common case I believe but yet I couldn't find any resource online

    Continue reading...

Compartilhe esta Página