Skip to content

fix(market): proxy dev websocket to backend - #187

Open
kcrmin wants to merge 1 commit into
developfrom
bugfix/dev-websocket-proxy
Open

kcrmin wants to merge 1 commit into
developfrom
bugfix/dev-websocket-proxy

Conversation

@kcrmin

@kcrmin kcrmin commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

What and why

marketData.ts opens the price stream at /ws/v1/market-data/prices on the API origin, which is the page origin when VITE_API_BASE_URL is empty (the default in Docker development). The Vite dev server only proxied /api/v1/backtests, /api and /actuator, so the WebSocket upgrade was never forwarded and the live price stream never connected locally.

This adds a /ws proxy rule with ws: true to the same VITE_REAL_API_TARGET (backend-api, which registers /ws/v1/market-data/prices). A small node-environment test pins the rule.

The unused VITE_WS_BASE_URL in root compose.front.yml is removed in the companion root PR (same branch name).

Verified

  • Stub upstream (plain Node HTTP server that completes the WebSocket handshake and sends one frame), Vite started with VITE_REAL_API_TARGET pointing at it:
    • develop: HTTP ticket proxied, WebSocket TIMEOUT, upstream never saw an upgrade
    • this branch: WebSocket OPEN and received {"stub":"price"}, upstream saw UPGRADE /ws/v1/market-data/prices?ticket=t-1
  • New src/viteDevProxy.test.ts fails on develop and passes here
  • node --test scripts/test-github-action-pins.mjs scripts/test-real-api-integration-workflow.mjs: passed
  • pnpm typecheck: clean
  • pnpm exec vitest run (Node 24): 690 passed (one earlier run hit the known create-dialog focus flake fixed by fix(competition): keep dialog focus on re-render #185; two reruns were green)
  • pnpm build && node scripts/assert-production-bundle.mjs: passed
  • CI=1 pnpm e2e: 26 passed

Checklist

  • Proxy only active when VITE_REAL_API_TARGET is set, as before
  • Production bundle unchanged
  • Companion root PR removes the unread env var

Related: Idea2Strategy/Idea2Strategy#531

The price stream opens /ws/v1 on the page origin, but the dev server
only proxied /api and /actuator, so the upgrade never reached backend.
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