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

Angular 19 SSR: App breaks when receiving \r\n in API response with net::ERR_CONTENT_LENGTH_MISMATCH #29567

Closed
1 task done
AnatoliiMazur opened this issue Feb 4, 2025 · 1 comment · Fixed by #29581
Closed
1 task done
Assignees
Labels
area: @angular/ssr freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix

Comments

@AnatoliiMazur
Copy link

AnatoliiMazur commented Feb 4, 2025

Command

version

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

18.2.12

Description

After building the project and starting the server, navigating to a page that contains \r\n in the API response and reloading the page causes Angular to stop working. The browser console shows the following error:
GET http://localhost:4000/about net::ERR_CONTENT_LENGTH_MISMATCH 200 (OK)

Minimal Reproduction

https://github.com/AnatoliiMazur/angular-19-bug

  1. Build the project and start the server
  2. Navigate to the page http://localhost:4000/about
  3. Reload the page
Image

Exception or Error

The page should render correctly, and Angular should work without errors.

Your Environment

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

Angular: 
... 

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.1901.5 (cli-only)
@angular-devkit/core         19.1.5 (cli-only)
@angular-devkit/schematics   19.1.5 (cli-only)
@schematics/angular          19.1.5 (cli-only)

Anything else relevant?

A minimal reproduction repository is available here.

@alan-agius4 alan-agius4 self-assigned this Feb 6, 2025
@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 Feb 6, 2025
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Feb 6, 2025
…es with `\r\n`

JS engines convert `\r\n` to `\n` in template literals, potentially leading to incorrect byte length calculations. This fix ensures the correct content length is determined.

Closes angular#29567
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue Feb 6, 2025
…es with `\r\n`

JS engines convert `\r\n` to `\n` in template literals, potentially leading to incorrect byte length calculations. This fix ensures the correct content length is determined.

Closes angular#29567
alan-agius4 added a commit that referenced this issue Feb 6, 2025
…es with `\r\n`

JS engines convert `\r\n` to `\n` in template literals, potentially leading to incorrect byte length calculations. This fix ensures the correct content length is determined.

Closes #29567

(cherry picked from commit 414736b)
@alan-agius4 alan-agius4 marked this as a duplicate of #29597 Feb 10, 2025
@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 Mar 9, 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