From 8a74335c21a57ee63c9a0658754430d6520dbc87 Mon Sep 17 00:00:00 2001 From: Adam Malczewski Date: Thu, 25 Jun 2026 08:02:26 +0900 Subject: fix(bin): pin dev ports in bin/up so shell BACKEND_PORT can't override .env MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bin/up ran `bun --watch main.ts` without setting BACKEND_PORT, so a shell-exported BACKEND_PORT (e.g. 24991 in ~/.bashrc, set so the Dispatch CLI hits the prod server) overrode .env's dev value 24203 — Bun lets shell env win over .env — binding the dev server onto the production port and colliding with the active dispatch-server systemd service. transport-http then failed to activate (Bun.serve "port in use"), so the HTTP server never came up and the frontend got "Failed to fetch". Force BACKEND_PORT=24203 + SURFACE_WS_PORT=24205 in the setsid invocation so the dev stack is deterministic regardless of the shell environment. --- bin/up | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bin/up b/bin/up index 8d529bc..c0a7cbf 100755 --- a/bin/up +++ b/bin/up @@ -43,7 +43,11 @@ echo "[up] frontend → http://localhost:24204 [vite HM echo "[up] Ctrl-C to stop both." echo -setsid bash -c "cd '$BACKEND' && exec bun --watch packages/host-bin/src/main.ts" \ +# Force the dev ports: a shell-exported BACKEND_PORT (e.g. 24991 from ~/.bashrc, +# set so the Dispatch CLI hits prod) would otherwise override .env and bind the +# dev server onto the production port (colliding with the prod systemd service). +# Bun lets shell env win over .env, so pin the dev ports here. +setsid bash -c "cd '$BACKEND' && exec env BACKEND_PORT=24203 SURFACE_WS_PORT=24205 bun --watch packages/host-bin/src/main.ts" \ > >(sed -u 's/^/[backend] /') 2>&1 & BACK_PG=$! -- cgit v1.2.3