Skip to content
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

SSR + Internationalization + pre-rendered routes does not return pre-rendered pages #27196

Open
timothyBrake opened this issue Mar 4, 2024 · 0 comments
Labels
area: @angular/ssr freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix

Comments

@timothyBrake
Copy link

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

language-service, platform-server

Is this a regression?

Yes

Description

When adding SSR and Internationalization to a project, the pre-rendered routes are not served.

Most basic example with preconfigured ssr + localize + prerender: https://github.com/lostium/ssr-i18n-angular17
But this is also visible with a clean Angular CLI project adding SSR + localize + Prerender

  1. Clean git clone of this project https://github.com/lostium/ssr-i18n-angular17
  2. Build the project
  3. Then manually update dist/ssr-i18n-angular17/browser/en/page-1/index.html and add text This is pre-rendered
  4. Start proxy server
  5. Open Chrome and make sure using DevTools > Network > Disable Cache is checked
  6. Using browser navigate to http://localhost:4000/en/page-1
  7. Should show the This is pre-rendered but it is NOT showing that page
  8. Using browser navigate to http://localhost:4000/en/page-1/index.html DOES show the pre-rendered page

Somewhere along the way Angular isn't serving the pre-rendered page when navigating to http://localhost:4000/en/page-1

To be clear: everything works as expected excluding Internationalisation and step 6 without the i18n does work http://localhost:4000/page-1 so its only after adding i18n that the pre-rendered page isn't being served.

Please provide a link to a minimal reproduction of the bug

https://github.com/lostium/ssr-i18n-angular17

Please provide the exception or error you saw

After manually updating the dist/ssr-i18n-angular17/browser/en/page-1/index.html page and starting the server and you navigate to _http://localhost:4000/en/page-1_ that pre-rendered page isn't being served.

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

Angular CLI: 17.2.2
Node: 20.11.1
Package Manager: npm 10.2.4
OS: darwin arm64

Angular: 17.2.3
... animations, common, core, forms, platform-browser
... platform-browser-dynamic, platform-server, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1702.2
@angular-devkit/build-angular   17.2.2
@angular-devkit/core            17.2.2
@angular-devkit/schematics      17.2.2
@angular/cli                    17.2.2
@angular/compiler               17.0.8
@angular/compiler-cli           17.0.8
@angular/localize               17.0.8
@angular/ssr                    17.2.2
@schematics/angular             17.2.2
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.4

Anything else?

The combination of SSR and Internationalisation isn't well documented and the ng update, ng add doesn't change the code to make it work together. Developers now have to go outside the official Angular documentation to make it work.
Would be great as well that the official Angular documentation has a working version of all these feature combined together with complete code of a most basic & running example: SSR + Internationalisation + Pre-render.

@alan-agius4 alan-agius4 transferred this issue from angular/angular Mar 4, 2024
@alan-agius4 alan-agius4 added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken area: @angular/ssr labels Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Development

No branches or pull requests

2 participants