Workers SDK Issue Reports

← Back to Dashboard

#11063 Vite plugin fails with vite-plugin-vue-devtools and remote bindings enabled

Recommendation:KEEP OPEN
Difficulty:medium
Reasoning:

Confirmed race condition in Vite Hot Channel initialization. Maintainer investigated, created reproduction repo. Affects multiple third-party plugins using hot.send().

Suggested Action:

Keep tracking - awaiting fix to queue messages before WebSocket connected.

Analysis Report

Issue Review: cloudflare/workers-sdk#11063

Summary

Vite plugin crashes with "The WebSocket is undefined" assertion error when using vite-plugin-vue-devtools and remote D1 bindings together.

Findings

  • Created: 2025-10-22
  • Updated: 2025-11-07
  • Version: @cloudflare/vite-plugin 1.13.14 → 1.21.2 (current)
  • Component: @cloudflare/vite-plugin (vite-plugin)
  • Labels: bug, vite-plugin
  • Comments: 2

Key Evidence

  1. Root cause identified by maintainer: Pete Bacon Darwin investigated and identified the issue as a race condition between the Hot Channel feature. Both vite-plugin-vue-devtools and @cloudflare/vite-plugin use Vite's Hot Channel. The initRunner() function (which sets up the WebSocket) is called before the CF plugin accesses the hot channel, but vite-plugin-vue-devtools accesses the hot channel early before initRunner is called.

  2. Additional plugin affected: Another user reported that vite-plugin-inspect has the same issue, also using hot.send to send custom messages.

  3. Condition: The issue occurs more frequently when remote bindings are enabled because initRunner() takes longer in that case. Without remote bindings, the timing issue is less likely to surface.

  4. Suggested fix from community: A user suggested queueing incoming messages before the WebSocket is connected and sending them afterwards.

  5. No fix found:

    • No merged PRs explicitly reference fixing this issue (#11063)
    • Changelog does not mention issue #11063
    • No related WebSocket/hot channel fixes found in recent changelog entries
  6. Reproduction repo exists: Maintainer created https://github.com/petebacondarwin/dark-rice-3c58 to debug the issue

Recommendation

Status: KEEP OPEN

Reasoning: This is a confirmed bug with a known root cause (race condition in Vite's Hot Channel initialization timing). A maintainer has investigated and reproduced the issue. No fix has been merged yet, and the bug affects multiple third-party plugins (vue-devtools, vite-plugin-inspect) that use Vite's hot.send() feature when combined with remote bindings.

Action: Keep tracking until a fix is implemented. The suggested solution of queueing messages before the WebSocket is connected appears viable.

Suggested Comment

N/A - Issue should remain open as a valid bug awaiting a fix.

Notes & Feedback (0)

No notes yet.

Add Note