fix: restore res.req for Node.js when createProxyHandler is set #213
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.28) × (1 − Review Confidence (0.48)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.28 · 52 lines diff across 2 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.00 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Shallow Review Depth
shallow_review_depth
0.350
Diff Size
diff_size
0.238
Real PR Conversation Timeline
2 items
Approved
lgtm
mcollina
prkomb
Since Node.js 26.11.0, when
createProxyHandleris set, any request that reaches the Express middleware crashes the process withERR_INTERNAL_ASSERTION. It's also why the Node 26 CI job fails onmainright now: the three tests that setcreateProxyHandlerfail on 26.13.0 (for example in #210).Express sets
res.reqto the request it's given, which here is the Proxy. nodejs/node#65802 (shipped in 26.11.0) replaced the per-requestfinishlistener with a shared one that readsres.reqand asserts it's the request the server created, so the assertion is thrown from thefinishevent. 26.10.0 is fine; 26.11.0, 26.13.0 and 26.13.1 crash.This puts the original request back on
res.reqin afinishlistener that runs before the one Node adds. While Express handles the request,res.reqis still the Proxy, so middleware and routes see no change.The new test checks that Express still sees the Proxy during the request and that
reply.raw.reqis the original request inonResponse. Without the fix it fails on Node 22 and 24 (it's still the Proxy) and on 26.13.0 (the assertion). With it,npm testpasses on 22, 24, 26.11.0, 26.13.0 and 26.13.1.POST request without form body workssometimes hits its 100 ms timeout when the machine is busy; I saw that on an unchangedmaintoo.Checklist
npm run test && npm run benchmark --if-presentand the Code of conduct