AngularNodeAppEngine : dynamic route paths added with Router.resetConfig during AppInitializer can't be reached on SSR #29238
Labels
area: @angular/ssr
feature: votes required
Feature request which is currently still in the voting phase
feature
Issue that requests a new feature
Command
build
Description
Hello everyone,
I'm currently trying to migrate an Angular 18 app with SSR enabled using CommonEngine. After switching to V19 I wanted to move to
AngularNodeAppEngine
to be able to have hybrid rendering but I'm facing an issue with dynamic route paths.The app we are working on, by default, has no pre-defined route paths. They all come from an API. The end user can edit all the slugs of its app on a dedicated interface.
So, during
APP_INITIALIZER
we fetch the routes from the API andRouter.resetConfig
.This is working using
CommonEngine
.But it doesn't when using AngularNodeAppEngine because of the route extraction phase during build time to feed the Manifest in this scenario.
When the app is built, let's say the end user has only activated one route
routeA
. The server manifest has only a route.But after some time, the end user chose to add another route to the app (
routeB
). DuringAPP_INITIALIZER
the route is correctly added to the router config, but since it's not part of the manifest,routeB
leads to a 404 on SSR.Minimal Reproduction
I added a repo to highlight the issue : https://github.com/jimjim2a/ssr-dynamic-routing.
Here are the steps to reproduce the issue :
We are in case there both SSR and CSR Router has correct configuration, but since the manifest extracted during build time is not complete, the SSR of the newly added route leads to 404.
Your Environment
Thanks everyone for all the great Job you're doing !
The text was updated successfully, but these errors were encountered: