Skip to content

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

Closed

Description

@timothyTheCoder

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.

Activity

  1. transferred this issue fromangular/angularon Mar 4, 2024
  2. added
    freq1: low
    on Mar 4, 2024
  3. self-assigned this
    on Aug 30, 2024
  4. added 19 commits that reference this issue on Sep 17, 2024
    3814f19
    6219e18
    abd4654
    602007d
    b8c2c09
    5c30f3d
    23c32aa
    f582e7e
    f6ccb97
    1163903
    598016d
    8e1a54c
    d33ec81
    293e376
    4046b77
    655b76a
    3974957
    f01d2da
    5de4d93
  5. added a commit that references this issue on Sep 19, 2024
    3b00fc9
  6. angular-automatic-lock-bot commented on Oct 20, 2024

    @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.

  7. locked and limited conversation to collaborators on Oct 20, 2024
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

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions