← Back to Pull requests

fix: restore res.req for Node.js when createProxyHandler is set #213

Merged
prkomb merged 2 files (52 lines) on Nov 20, 2026 17:17 UTC
View on GitHub
prkomb prkomb commented on Nov 18, 2026 20:26 UTC
Author

Since Node.js 26.11.0, when createProxyHandler is set, any request that reaches the Express middleware crashes the process with ERR_INTERNAL_ASSERTION. It's also why the Node 26 CI job fails on main right now: the three tests that set createProxyHandler fail on 26.13.0 (for example in #210).

Express sets res.req to the request it's given, which here is the Proxy. nodejs/node#65802 (shipped in 26.11.0) replaced the per-request finish listener with a shared one that reads res.req and asserts it's the request the server created, so the assertion is thrown from the finish event. 26.10.0 is fine; 26.11.0, 26.13.0 and 26.13.1 crash.

This puts the original request back on res.req in a finish listener that runs before the one Node adds. While Express handles the request, res.req is 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.req is the original request in onResponse. 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 test passes on 22, 24, 26.11.0, 26.13.0 and 26.13.1. POST request without form body works sometimes hits its 100 ms timeout when the machine is busy; I saw that on an unchanged main too.

Checklist

  • run npm run test && npm run benchmark --if-present

  • tests and/or benchmarks are included

  • documentation is changed or added (no docs change needed)

  • commit message and code follows the Developer's Certification of Origin

  • and the Code of conduct

    Diff: 52 lines (+51 / -1) across 2 files Reviewer: mcollina Review duration: 2690m
    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
    0.28
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.00 · 1 substantive comment(s)
    0.00
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    48%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    mcollina mcollina approved these changes on Nov 20, 2026 17:17 UTC
    Approved Reviewer

    lgtm

    Reviewers
    Assignees
    prkomb prkomb
    Labels
    risk: low confidence: 48.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 28.2% (LOW) · Higher = larger blast radius
    28.2%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 48.5% · Lower = rushed or shallow review
    48.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 14.5% · Safe to merge
    14.5%