Skip to content

fix: use HTTP API to get WebSocket UUID for headless Chrome#73

Open
ghoenixfang-dot wants to merge 2 commits intoeze-is:mainfrom
ghoenixfang-dot:fix-websocket-uuid
Open

fix: use HTTP API to get WebSocket UUID for headless Chrome#73
ghoenixfang-dot wants to merge 2 commits intoeze-is:mainfrom
ghoenixfang-dot:fix-websocket-uuid

Conversation

@ghoenixfang-dot
Copy link
Copy Markdown

Summary

Fix for CDP proxy connection failure when Chrome is started with --remote-debugging-port in headless mode.

Problem

When Chrome is started with --remote-debugging-port, the DevToolsActivePort file is not created. This causes cdp-proxy.mjs to fall back to connecting to /devtools/browser without a UUID, which fails in headless mode (connection closes immediately with code 1006).

Solution

After detecting an open Chrome debugging port via TCP, query the Chrome HTTP API at http://127.0.0.1:{port}/json/version to get the actual webSocketDebuggerUrl containing the UUID. Use this UUID path for the WebSocket connection.

Changes

  • Added getWsPathFromHttpApi() function to query Chrome's JSON version endpoint
  • Modified discoverChromePort() to use HTTP API fallback when DevToolsActivePort is unavailable

Test Result

node: ok (v24.14.0)
chrome: ok (port 9222)
proxy: ready

Generated with Claude Code

root added 2 commits May 3, 2026 12:44
When Chrome is started with --remote-debugging-port, the DevToolsActivePort
file is not created, causing cdp-proxy to connect to /devtools/browser
without UUID, which fails in headless mode. This fix queries the Chrome
HTTP API at /json/version to get the actual WebSocket URL with UUID.
- Added docs/PR-73-WEBSOCKET-UUID-FIX.md with detailed analysis
- Documented problem, solution, test results, and environment
- Linked to PR: eze-is#73
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