Skip to content

SSG Build cannot extract routes #31254

@DominikFra

Description

@DominikFra

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

Don't known / other

Is this a regression?

Yes

Description

Dear Angular DEVs,

I have a pretty simple/basic setup of an angular app using the new SSG Feature.

With angular 20.3.1 on Prod Build I get following (not very expressive) error message

✘ [ERROR] An error occurred while extracting routes.

NG0401

On angular 20.2.3 it was working fine. and generating static pages.

my app.routes.server.ts looks like this:

export const serverRoutes: ServerRoute[] = [
    {
        path: '**',
        renderMode: RenderMode.Prerender,
        fallback: PrerenderFallback.Client,
        async getPrerenderParams() {
            const routes = inject(RoutesService);
            const ids = await routes.getRoutes(); // returns ['/twix', '/snickers']
            return ids.map(x => ({ '**': x }));
        },
    },
];

PS: LOVE the new SSG Feature. works awesome (with angular 20.2.3)

best,
Dominik

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

> ✘ [ERROR] An error occurred while extracting routes.
> 
> NG0401

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

Angular CLI: 20.3.1
Node: 22.19.0
Package Manager: npm 10.9.3
OS: linux x64
    

Angular: 20.3.1
... build, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-server, router, ssr

Package                         Version
---------------------------------------
@angular-devkit/architect       0.2003.1
@angular-devkit/build-angular   20.3.1
@angular-devkit/core            20.3.1
@angular-devkit/schematics      20.3.1
@schematics/angular             20.3.1
rxjs                            7.8.2
typescript                      5.8.3

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions