Skip to content

SSG generates empty index.html if navigation in guard #31618

@Schoko19961

Description

@Schoko19961

Which @angular/* package(s) are the source of the bug?

platform-server

Is this a regression?

Yes

Description

Latest working version: 20.3.6

If a route that's configured to be prerendered, contains a guard which navigates somewhere else, ssg generates an empty index.html

In the reproduction:

  • When a user navigates to /subroute he should be navigated to /subroute/subsub
  • No error message or hint that this is happening is thrown

Workaround:

  • disable the guard when platform is server

Please provide a link to a minimal reproduction of the bug

https://github.com/Schoko19961/angular-ssg-empty-index-html

Please provide the exception or error you saw

No exception or warning was logged

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.3.7
Node: 22.20.0
Package Manager: npm 10.9.3
OS: linux x64
    

Angular: 20.3.7
... build, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-server, router, ssr

Package                      Version
------------------------------------
@angular-devkit/architect    0.2003.7
@angular-devkit/core         20.3.7
@angular-devkit/schematics   20.3.7
@schematics/angular          20.3.7
rxjs                         7.8.2
typescript                   5.9.3
zone.js                      0.15.1

Anything else?

No response

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions