Skip to content

fix(@angular/ssr): abort web request signal when node request is aborted - #33879

Open
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix-ssr-abort-signal
Open

fix(@angular/ssr): abort web request signal when node request is aborted#33879
alan-agius4 wants to merge 1 commit into
angular:mainfrom
alan-agius4:fix-ssr-abort-signal

Conversation

@alan-agius4

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

When converting a Node.js IncomingMessage or Http2ServerRequest into a Web Request object in @angular/ssr, if the underlying Node request is aborted/closed prematurely, the Web Request object's signal does not abort.

What is the new behavior?

Connects an AbortController to the aborted event on the Node.js request so that the Web Request's signal is aborted whenever the incoming Node request is aborted.

Does this PR introduce a breaking change?

  • Yes
  • No

@alan-agius4
alan-agius4 requested a review from dgp1130 August 19, 2026 09:16
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels Aug 19, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces abort handling for incoming Node.js requests by mapping the 'aborted' event to an AbortController signal on the created Web Request, with corresponding tests added for HTTP/1.1 and HTTP/2. Feedback suggests handling cases where the request is already aborted before the handler is registered, and cleaning up the event listener on 'close' to prevent potential memory leaks.

Comment thread packages/angular/ssr/node/src/request.ts Outdated
@alan-agius4
alan-agius4 force-pushed the fix-ssr-abort-signal branch from f74bc4e to 5053c9f Compare August 19, 2026 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: review The PR is still awaiting reviews from at least one requested reviewer area: @angular/ssr target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant