Skip to content

fix: replace deprecated 'aborted' event with 'close' on IncomingMessage#4579

Open
sapirbaruch wants to merge 1 commit into
hapijs:masterfrom
sapirbaruch:fix/replace-deprecated-aborted-event
Open

fix: replace deprecated 'aborted' event with 'close' on IncomingMessage#4579
sapirbaruch wants to merge 1 commit into
hapijs:masterfrom
sapirbaruch:fix/replace-deprecated-aborted-event

Conversation

@sapirbaruch
Copy link
Copy Markdown

The 'aborted' event on http.IncomingMessage was deprecated in Node.js v17 and no longer fires in v24+. As a result, Request.active() always returns true because _eventContext.request is never set to null on client disconnects.

The fix replaces req.on('aborted', ...) with req.on('close', ...) and guards the abort logic with a res.writableEnded check — the same guard used by the existing res.on('close') handler — to distinguish a premature client disconnect from a normal connection teardown.

Fixes #4575.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The abort event on nodejs is deprecated

1 participant