[PR #245] [MERGED] fix(http): remove allowH2 from undici Agent — causes fetch failed on Node.js 22+ #299

Closed
opened 2026-02-15 17:16:44 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/openclaw/clawhub/pull/245
Author: @DColl
Created: 2/12/2026
Status: Merged
Merged: 2/12/2026
Merged by: @steipete

Base: mainHead: main


📝 Commits (2)

  • f82134c Remove allowH2 option from global dispatcher
  • b926995 fix(http): remove allowH2 from e2e dispatcher

📊 Changes

2 files changed (+0 additions, -2 deletions)

View changed files

📝 e2e/clawdhub.e2e.test.ts (+0 -1)
📝 packages/clawdhub/src/http.ts (+0 -1)

📄 Description

Remove allowH2 option from global dispatcher

Problem

allowH2: true in the undici Agent dispatcher causes fetch failed
on Node.js 22+ (tested on v25.6.1), making clawhub login completely
broken for all Node.js users.

curl handles the same request fine (HTTP/2 negotiation works correctly
via curl), so the issue is specific to undici's HTTP/2 implementation
on recent Node versions.

Fix

Remove allowH2: true from the Agent config. undici will fall back to
HTTP/1.1 which works correctly.

Testing

  • OS: Ubuntu 24.04, Node.js v25.6.1
  • clawhub login --token <token> now authenticates successfully

Related

Fixes #41
Related: openclaw/openclaw#5366, openclaw/openclaw#6933

Note on the published dist/

The currently published dist/http.js on npm also has a separate
corruption (missing controller/body declarations and a broken
console.log with random whitespace) that doesn't match these sources.
That suggests a build pipeline issue — the npm package may have been
built from a different state than the current source.

Greptile Overview

Greptile Summary

This change updates the CLI HTTP client’s undici global dispatcher (packages/clawdhub/src/http.ts) to stop forcing HTTP/2 (allowH2: true), relying on undici’s default (HTTP/1.1) to avoid fetch failed regressions reported on newer Node.js versions.

The change is scoped to dispatcher configuration and does not alter request/response handling logic in apiRequest* helpers; it only affects the underlying transport negotiation used by fetch in Node runtimes.

Confidence Score: 3/5

  • Reasonably safe, but test configuration likely breaks on Node 22+
  • The code change itself is a minimal deletion in dispatcher config and should resolve the reported Node 22+ undici HTTP/2 issue. However, the repo’s e2e test harness still forces allowH2: true on a global dispatcher, which will likely cause the same fetch failed failures in CI/Node 22+ environments and should be updated in tandem.
  • e2e/clawdhub.e2e.test.ts

Last reviewed commit: f82134c

(2/5) Greptile learns from your feedback when you react with thumbs up/down!


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/openclaw/clawhub/pull/245 **Author:** [@DColl](https://github.com/DColl) **Created:** 2/12/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@steipete](https://github.com/steipete) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`f82134c`](https://github.com/openclaw/clawhub/commit/f82134c9ad2f9162092b6cfb31d252f8f2605b34) Remove allowH2 option from global dispatcher - [`b926995`](https://github.com/openclaw/clawhub/commit/b9269953cdf4c3736fb1246caab29e8b4be75648) fix(http): remove allowH2 from e2e dispatcher ### 📊 Changes **2 files changed** (+0 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `e2e/clawdhub.e2e.test.ts` (+0 -1) 📝 `packages/clawdhub/src/http.ts` (+0 -1) </details> ### 📄 Description Remove allowH2 option from global dispatcher ## Problem `allowH2: true` in the undici Agent dispatcher causes `fetch failed` on Node.js 22+ (tested on v25.6.1), making `clawhub login` completely broken for all Node.js users. curl handles the same request fine (HTTP/2 negotiation works correctly via curl), so the issue is specific to undici's HTTP/2 implementation on recent Node versions. ## Fix Remove `allowH2: true` from the Agent config. undici will fall back to HTTP/1.1 which works correctly. ## Testing - OS: Ubuntu 24.04, Node.js v25.6.1 - `clawhub login --token <token>` now authenticates successfully ## Related Fixes #41 Related: openclaw/openclaw#5366, openclaw/openclaw#6933 ## Note on the published dist/ The currently published `dist/http.js` on npm also has a separate corruption (missing `controller`/`body` declarations and a broken `console.log` with random whitespace) that doesn't match these sources. That suggests a build pipeline issue — the npm package may have been built from a different state than the current source. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This change updates the CLI HTTP client’s undici global dispatcher (`packages/clawdhub/src/http.ts`) to stop forcing HTTP/2 (`allowH2: true`), relying on undici’s default (HTTP/1.1) to avoid `fetch failed` regressions reported on newer Node.js versions. The change is scoped to dispatcher configuration and does not alter request/response handling logic in `apiRequest*` helpers; it only affects the underlying transport negotiation used by `fetch` in Node runtimes. <h3>Confidence Score: 3/5</h3> - Reasonably safe, but test configuration likely breaks on Node 22+ - The code change itself is a minimal deletion in dispatcher config and should resolve the reported Node 22+ undici HTTP/2 issue. However, the repo’s e2e test harness still forces `allowH2: true` on a global dispatcher, which will likely cause the same `fetch failed` failures in CI/Node 22+ environments and should be updated in tandem. - e2e/clawdhub.e2e.test.ts <sub>Last reviewed commit: f82134c</sub> <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 17:16:44 -05:00
yindo closed this issue 2026-02-15 17:16:45 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: openclaw/clawhub#299