Skip to content

Routes beginning with Dynamic Parameters break Angular Prerendering and SSR #29452

Closed

Description

@robertsine

Command

build, serve

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

Angular provides examples on how to use prerendering for parametrized routes like post/:id. However, in our project, we have routes with dynamic parameters at the beginning of the route path, such as :seoAlias/:category/:offerId.

This specific route structure causes issues in Client, Server, and Prerender modes, breaking other routes when serving the app in development mode or building the application.

Minimal Reproduction

We have created a simple reproduction repository:
https://github.com/robertsine/car-shop

Inside the file app.routes.server.ts there are several route variants. By uncommenting them, you can reproduce the issue. Notably, only offers/:slug works well. Other server routes are breaking entire app, when serving app in dev mode or serving build.

We tried to use the ** path as a hack to prerender our parameterized routes. However, in development mode, it does not work. In build mode, it creates prerendered pages. For note, we must ensure unique parameters across the entire route configuration to avoid hitting several paths with same parameter name. However, it generates fallback content inside the index files.

Exception or Error

Error: Error(s) occurred while extracting routes:
- The '' server route does not match any routes defined in the Angular routing configuration (typically provided as a part of the 'provideRouter' call). Please make sure that the mentioned server route is present in the Angular routing configuration.

Your Environment

Angular CLI: 19.0.6
Node: 22.13.1
Package Manager: npm 9.5.1
OS: win32 x64

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

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1900.6
@angular-devkit/build-angular   19.0.6
@angular-devkit/core            19.0.6
@angular-devkit/schematics      19.0.6
@angular/cli                    19.0.6
@angular/ssr                    19.0.6
@schematics/angular             19.0.6
rxjs                            7.8.1
typescript                      5.6.3
zone.js                         0.15.0

Anything else relevant?

No response

Activity

  1. self-assigned this
    on Jan 22, 2025
  2. added
    freq1: low
    on Jan 23, 2025
  3. added 13 commits that reference this issue on Jan 23, 2025
    20325a0
    0d2acbb
    6b9be13
    33da2e6
    cb9153f
    de2b5b1
    bee579f
    76a7d9d
    b01f492
    1667dba
    ffea3ad
    4258fa0
    4df97d1
  4. added a commit that references this issue on Jan 24, 2025
    94643d5
  5. angular-automatic-lock-bot commented on Feb 24, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area: @angular/ssrfreq1: lowseverity3: brokentype: bug/fix

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions