fix(web): SvelteKit-env via \$env/dynamic/public statt import.meta.env
Some checks are pending
CI / validate (push) Waiting to run

Bug: Browser-Client requested localhost:3081 statt cardecky-api.mana.how
nach Login. Ursache: API_BASE und authBaseUrl() lasen die Variable
über import.meta.env.PUBLIC_*, was unter SvelteKit nicht zuverlässig
inlined wird (Vite-direct, ohne SvelteKit-Wrapper-Hook).

Fix: \$env/dynamic/public liest die env zur Runtime aus den Node-
Server-Variablen (adapter-node) — Browser bekommt sie über den
SSR-Init-Snapshot. Damit muss die Variable nur als runtime-env am
Container hängen, nicht als Build-Arg.

docker-compose.production.yml: PUBLIC_CARDS_API_URL und
PUBLIC_MANA_AUTH_URL aus build.args nach environment verschoben.
Build-Pipeline: cards-web muss neu gebaut werden, sonst greift der
Wechsel von static→dynamic env nicht.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Till JS 2026-05-08 22:03:35 +02:00
parent 3b745836bd
commit 87a7a31ece
3 changed files with 17 additions and 8 deletions

View file

@ -103,11 +103,15 @@ services:
dockerfile: apps/web/Dockerfile
args:
NPM_AUTH_TOKEN: ${NPM_AUTH_TOKEN:?missing NPM_AUTH_TOKEN}
PUBLIC_CARDS_API_URL: https://cardecky-api.mana.how
restart: unless-stopped
depends_on:
- cards-api
environment:
# SvelteKit `$env/dynamic/public` liest zur Runtime — daher
# hier statt als Build-Arg. Wert landet im SSR-Init-Snapshot
# und in client-fetches.
PUBLIC_CARDS_API_URL: https://cardecky-api.mana.how
PUBLIC_MANA_AUTH_URL: https://auth.mana.how
CARDS_API_URL: https://cardecky-api.mana.how
NODE_ENV: production
ports: