Skip to content

fix(web-incoming): remove deprecated request abort APIs#107

Merged
pi0 merged 1 commit intomainfrom
fix/request-abort-node16
Mar 25, 2026
Merged

fix(web-incoming): remove deprecated request abort APIs#107
pi0 merged 1 commit intomainfrom
fix/request-abort-node16

Conversation

@pi0
Copy link
Copy Markdown
Member

@pi0 pi0 commented Mar 25, 2026

Summary

  • Remove deprecated req.on("aborted") listener — broken on Node 16+ and redundant since res.on("close") already handles client disconnect cleanup
  • Replace all proxyReq.abort() calls with proxyReq.destroy() (both abort() and the aborted event were deprecated in Node 16)
  • Add regression test verifying upstream proxy request is destroyed when client disconnects

Upstream reference: http-party/node-http-proxy#1580

Details

httpxy already had the core fix (res.on("close", () => proxyReq.destroy())) but still carried the deprecated req.on("aborted") listener and used proxyReq.abort() in timeout/error handlers. This PR completes the cleanup:

  1. req.on("aborted") — Removed. The aborted event on IncomingMessage was deprecated in Node 16. The existing res.on("close") with !res.writableFinished guard already handles client disconnects correctly.

  2. proxyReq.abort() — Replaced with proxyReq.destroy() in three locations: proxy timeout handler, error handler (ECONNRESET), and redirect timeout handler.

Test plan

  • Added regression test: "should destroy upstream proxy request when client aborts"
  • All 229 existing tests pass

…ed")`

Replace deprecated `proxyReq.abort()` with `proxyReq.destroy()` and remove
redundant `req.on("aborted")` listener that was broken on Node 16+.
The `res.on("close")` handler already covers client disconnect cleanup.

Upstream: http-party/node-http-proxy#1580
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 25, 2026

Warning

Rate limit exceeded

@pi0 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 13 minutes and 41 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6ca56250-0ea6-482d-bc4e-2ab72ed8c25e

📥 Commits

Reviewing files that changed from the base of the PR and between 8724245 and 1ec8a21.

📒 Files selected for processing (2)
  • src/middleware/web-incoming.ts
  • test/http-proxy.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/request-abort-node16

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 25, 2026

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.29%. Comparing base (8724245) to head (1ec8a21).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/middleware/web-incoming.ts 66.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #107      +/-   ##
==========================================
+ Coverage   96.14%   96.29%   +0.14%     
==========================================
  Files           8        8              
  Lines         623      621       -2     
  Branches      233      233              
==========================================
- Hits          599      598       -1     
+ Misses         24       23       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pi0 pi0 merged commit b44af4a into main Mar 25, 2026
6 of 7 checks passed
@pi0 pi0 deleted the fix/request-abort-node16 branch March 25, 2026 19:52
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.

1 participant