From 330ec8c5038b279ffb014fcca174eac356de542d Mon Sep 17 00:00:00 2001 From: Andrew Bryant Date: Sat, 26 Sep 2026 16:47:23 -0400 Subject: [PATCH] tests: fix APP_URL port mismatch in the interactive VM `just boot-vm` forwards the guest's port 80 to host port 8080 (QEMU_NET_OPTS in the justfile), but the backend builds absolute URLs (e.g. the stored company logo path returned by the upload API) from APP_URL, which defaults to plain "http://localhost" with no port. The SPA's own relative URLs are fine - they inherit whatever port the browser is already on - but any backend-generated absolute URL then points at host port 80, where nothing is listening, instead of the forwarded 8080. That gave a silent net::ERR_CONNECTION_REFUSED for the logo image specifically, even though the upload itself succeeded. Verified directly: with APP_URL overridden to "http://localhost:8080", a freshly uploaded logo's URL is "http://localhost:8080/storage/.../....png" instead of missing the port. Automated test checks are unaffected (checks derivation hash unchanged) since they curl the guest's own localhost directly, with no host-side port remap involved. Co-Authored-By: Claude Sonnet 5 --- tests/default.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/default.nix b/tests/default.nix index 114f4c7..8845efe 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -30,6 +30,15 @@ services.resolved.enable = true; + # `just boot-vm` forwards the guest's port 80 to host port 8080 (QEMU_NET_OPTS in the justfile), + # but the backend builds absolute URLs (e.g. the stored company logo path) from APP_URL, which + # defaults to plain "http://localhost" with no port. The SPA's own relative URLs are fine (they + # inherit whatever port the browser is already on), but any backend-generated absolute URL then + # points at host port 80 - where nothing is listening - instead of the forwarded 8080, giving a + # silent net::ERR_CONNECTION_REFUSED for things like the logo image. Override to match the actual + # forwarded port. + services.invoiceninja.settings.APP_URL = "http://localhost:8080"; + # The qemu-vm module's defaults (1 core, 1024MB) are too tight for real interactive use: MySQL + # Redis + PHP-FPM + chromium (PDF generation, spawned per request - each is a full multi-process # browser, not a lightweight renderer) running concurrently can exhaust 1GB fast, and this VM