Skip to content

fix(uws): handle failing upgrade hooks and log rejection body errors - #226

Merged
pi0 merged 1 commit into
mainfrom
fix/uws-upgrade-rejection-robustness
Nov 11, 2026
Merged

pi0 merged 1 commit into
mainfrom
fix/uws-upgrade-rejection-robustness

Conversation

@pi0x

@pi0x pi0x commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #223, and the uWS counterpart of #224 (Node).

Changes

  • A throwing upgrade hook was an unhandled rejection. uWS doesn't await the upgrade handler, so the error escaped. The adapter now logs it and responds with a 500, matching the Node adapter.
  • Rejection body errors are logged. fix(uws): let uWS frame upgrade rejection responses #223 closes the connection when the body fails mid-stream; that behavior is kept, but the error is now logged instead of being caught without a trace.
  • Response.error() (status 0) is sent as a 500, where it used to produce a 0 status line.
  • Status text. Characters that aren't allowed in a reason phrase are stripped from statusText, so a CR/LF can't split the response.

Tests

New uws (upgrade rejection robustness) tests cover each item. All four fail against main and pass with this change.

🤖 Generated with AI assistant

@vercel

vercel Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
crossws Ready Ready Preview Nov 11, 2026 1:28pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Nov 11, 2026 •

Copy link
Copy Markdown

Explain Change →

Pre-merge checks: Passed 1 · Inconclusive 1

Failed Failed checks: 1 inconclusive

Check name Status Explanation Resolution
Title check Pending This assessment has not completed. The check will be retried on the next pre-merge check run.
Passed Passed checks: 1 passed

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@pi0
pi0 changed the base branch from fix/uws-upgrade-reject-framing to main November 11, 2026 13:27
- turn a throwing `upgrade` hook into a logged 500 instead of an unhandled
  rejection (uWS doesn't await the handler)
- log a rejection body that fails mid-stream instead of dropping the error
- send `Response.error()` (status 0) as 500 and strip invalid characters
  (CR/LF) from the status text
@pi0x
pi0x force-pushed the fix/uws-upgrade-rejection-robustness branch from 349522d to a62f645 Compare November 11, 2026 13:28
@pi0x pi0x changed the title fix(uws): handle failing upgrade hooks and rejection bodies fix(uws): handle failing upgrade hooks and log rejection body errors Nov 11, 2026
@pi0
pi0 merged commit 4992a6c into main Nov 11, 2026
6 of 8 checks passed
@codecov

codecov Bot commented Nov 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@pi0
pi0 deleted the fix/uws-upgrade-rejection-robustness branch November 11, 2026 13:30

This branch was successfully deployed

1 active deployment
Preview — a62f645e Deployed Nov 11, 2026 by vercel[bot]
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.

2 participants