Vite proxy points at the wrong port

The interface loads, but every API call fails or returns from a dead port.

Symptom

The dashboard renders, but data never arrives; the network panel shows requests failing against a port the backend is not listening on.

Cause

Vite reads VITE_BACKEND_PORT at startup from its own working directory. If you start it by hand from apps/web without that environment, it falls back to 3001 while the backend listens on PORT.

Fix

  1. Start through the launcher

    The root launcher gives Vite the correct working directory and environment.

    node scripts/start.mjs
  2. Or set the variable deliberately

    Create the frontend environment file with the same port the backend uses.

  3. Confirm both sides

    The backend prints its manager URL; the browser's failed requests should name the same port.

Prevention

Do not launch the two halves from different terminals with different working directories. One launcher, one environment.

Another thing to check

If the proxy target looks correct and calls still fail, check the browser's origin against FRONTEND_URL. A CORS rejection and a dead proxy both produce failed API calls, but they need different fixes.

In one sentence

Start both halves from one launcher so Vite reads the same environment as the backend, and confirm the failed request names the port the backend is listening on.