Skip to content

Prerender pages with query to SSR and Localize #29587

Closed
@detobel36

Description

@detobel36

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When building an angular project where SSR and Localize are set up in addition to hybrid rendering, an error occurs.
The host "ng-localhost" is used and obviously, the request to SSR failed.
I build using the command: ng build --localize

I want pre-rendered pages that call the method I declare in SSR to load some content from a database and build the website. It makes sense because this database is not updated often (it lists for example the menu items).

I don't have the error if localize is not set up.

Minimal Reproduction

https://github.com/detobel36/angular-ssr-localize

Exception or Error

ERROR Wr {
  headers: e {
    headers: Map(0) {},
    normalizedNames: Map(0) {},
    lazyInit: undefined,
    lazyUpdate: null
  },
  status: 0,
  statusText: 'Unknown Error',
  url: 'http://ng-localhost/api/data',
  ok: false,
  type: undefined,
  name: 'HttpErrorResponse',
  message: 'Http failure response for http://ng-localhost/api/data: 0 undefined',
  error: TypeError: fetch failed
      at node:internal/deps/undici/undici:13502:13
      at a.invoke (file:///home/rdetobel/Documents/Developpement/test-ssr/.angular/prerender-root/44393660-3cef-487c-bebf-fce65705e2ef/polyfills.server.mjs:1:6853)
      at l.run (file:///home/rdetobel/Documents/Developpement/test-ssr/.angular/prerender-root/44393660-3cef-487c-bebf-fce65705e2ef/polyfills.server.mjs:1:2099)
      at file:///home/rdetobel/Documents/Developpement/test-ssr/.angular/prerender-root/44393660-3cef-487c-bebf-fce65705e2ef/polyfills.server.mjs:2:582
      at a.invokeTask (file:///home/rdetobel/Documents/Developpement/test-ssr/.angular/prerender-root/44393660-3cef-487c-bebf-fce65705e2ef/polyfills.server.mjs:1:7482)
      at l.runTask (file:///home/rdetobel/Documents/Developpement/test-ssr/.angular/prerender-root/44393660-3cef-487c-bebf-fce65705e2ef/polyfills.server.mjs:1:2747)
      at R (file:///home/rdetobel/Documents/Developpement/test-ssr/.angular/prerender-root/44393660-3cef-487c-bebf-fce65705e2ef/polyfills.server.mjs:1:9542)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5) {
    [cause]: Error: getaddrinfo EAI_AGAIN ng-localhost
        at GetAddrInfoReqWrap.onlookupall [as oncomplete] (node:dns:120:26) {
      errno: -3001,
      code: 'EAI_AGAIN',
      syscall: 'getaddrinfo',
      hostname: 'ng-localhost'
    }
  }
}

Your Environment

Angular CLI: 19.1.6
Node: 22.13.1
Package Manager: yarn 1.22.22
OS: linux x64

Angular: 19.1.5
... animations, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1901.6
@angular-devkit/build-angular   19.1.6
@angular-devkit/core            19.1.6
@angular-devkit/schematics      19.1.6
@angular/cli                    19.1.6
@angular/ssr                    19.1.6
@schematics/angular             19.1.6
rxjs                            7.8.1
typescript                      5.7.3
zone.js                         0.15.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions