Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
robertsine opened this issue Jan 22, 2025 · 1 comment · Fixed by #29461
Closed
1 task

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

robertsine opened this issue Jan 22, 2025 · 1 comment · Fixed by #29461
Assignees
Labels
area: @angular/ssr freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix

Comments

@robertsine
Copy link

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

@alan-agius4 alan-agius4 self-assigned this Jan 22, 2025
@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix labels Jan 23, 2025
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 23, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Jan 24, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes angular#29452
alan-agius4 added a commit that referenced this issue Jan 24, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes #29452
alan-agius4 added a commit that referenced this issue Jan 24, 2025
…nce and accuracy

Updated route matching logic to prioritize closest matches, improving the accuracy of dynamic route resolution. Also we optimized performance by eliminating unnecessary recursive checks, reducing overhead during route matching.

Closes #29452

(cherry picked from commit 4df97d1)
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/ssr freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix
Projects
None yet
2 participants