[PR #8111] [MERGED] fix(client): proxy dev /api to the PORT in the root .env #8107

Closed
opened 2026-10-24 04:10:26 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/8111
Author: @ylli-selmani
Created: 10/22/2026
Status: ✅ Merged
Merged: 10/22/2026
Merged by: @ylli-selmani

Base: staging ← Head: fix/vite-proxy-env-port


📝 Commits (2)

  • b4c8b43 fix(client): proxy dev /api to the PORT in the root .env
  • d34d3db fix(client): resolve the dev proxy PORT like the server does

📊 Changes

1 file changed (+32 additions, -1 deletions)

View changed files

📝 packages/client/vite.config.ts (+32 -1)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

No issue yet. This is a small dev-tooling bug found while running several checkouts side by side; one should be opened if a maintainer wants it tracked separately.

Why this change

  • The Vite dev proxy forwarded /api to http://127.0.0.1:${process.env.PORT ?? 7860}. PORT reaches Vite only when it is exported in the shell, but the server reads it from the root .env. So pnpm --filter @marinara-engine/client dev (or any launcher that starts the client without exporting PORT) proxied to 7860 even when .env said otherwise.
  • Result: the dev client silently talked to a different Marinara instance (often a normal install on 7860), so changes looked "not working", and the build-skew banner fired forever because that instance reports another commit.

What changed

  • packages/client/vite.config.ts: the dev proxy port now resolves the way the server's getPort() does: an exported PORT wins (dotenv never overrides it), otherwise PORT from the root .env, parsed with Number.parseInt, falling back to 7860. The file is read with node:util parseEnv, not a repo script, so container builds (which do not copy scripts/) still resolve the config.
  • Dev server only: production builds and the server are unchanged.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-side checks (not a substitute for the boxes above): pnpm check exit 0 on this branch. A probe loaded vite.config.ts through Vite's loadConfigFromFile and printed the /api target:

Setup Target
no .env, no PORT 7860
.env PORT=6999, nothing exported 6999 (staging: 7860)
.env 6999, exported PORT=7001 7001
.env 6999, exported PORT= (empty) 7860 (server: 7860 too)
.env PORT=6999x 6999 (same as getPort())
.env PORT= (empty) 7860
.env PORT="6999" # comment 6999

Local CodeRabbit (--committed --base origin/staging) on the first commit: 0 findings. Dottore round 1 found the container-build break (the first version imported scripts/read-launcher-env.mjs, which the images do not copy) and the raw-string port; both fixed in the second commit.

No regression test: vite.config.ts has no test harness, and the resolution is a few lines mirroring getPort(); the probe above is the proof.

Manual verification notes

  • Manually verify: with PORT=<not 7860> in the root .env and PORT not exported, run pnpm --filter @marinara-engine/client dev next to a server on that port, open the dev URL, and confirm the app loads data from that server and no build-skew banner appears.
  • Manually verify: with PORT exported in the shell, the exported value still wins over .env.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

No docs reference the proxy port, so none were changed.

UI evidence (if applicable)

Not a UI change.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/8111 **Author:** [@ylli-selmani](https://github.com/ylli-selmani) **Created:** 10/22/2026 **Status:** ✅ Merged **Merged:** 10/22/2026 **Merged by:** [@ylli-selmani](https://github.com/ylli-selmani) **Base:** `staging` ← **Head:** `fix/vite-proxy-env-port` --- ### 📝 Commits (2) - [`b4c8b43`](https://github.com/Pasta-Devs/Marinara-Engine/commit/b4c8b43bf9270afb354fc2a311fc1a4c9a932516) fix(client): proxy dev /api to the PORT in the root .env - [`d34d3db`](https://github.com/Pasta-Devs/Marinara-Engine/commit/d34d3db1b47a3a45c24c7b10fc3720ee5d959b00) fix(client): resolve the dev proxy PORT like the server does ### 📊 Changes **1 file changed** (+32 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/vite.config.ts` (+32 -1) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue No issue yet. This is a small dev-tooling bug found while running several checkouts side by side; one should be opened if a maintainer wants it tracked separately. ## Why this change - The Vite dev proxy forwarded `/api` to `http://127.0.0.1:${process.env.PORT ?? 7860}`. `PORT` reaches Vite only when it is exported in the shell, but the server reads it from the root `.env`. So `pnpm --filter @marinara-engine/client dev` (or any launcher that starts the client without exporting `PORT`) proxied to 7860 even when `.env` said otherwise. - Result: the dev client silently talked to a different Marinara instance (often a normal install on 7860), so changes looked "not working", and the build-skew banner fired forever because that instance reports another commit. ## What changed - `packages/client/vite.config.ts`: the dev proxy port now resolves the way the server's `getPort()` does: an exported `PORT` wins (dotenv never overrides it), otherwise `PORT` from the root `.env`, parsed with `Number.parseInt`, falling back to 7860. The file is read with `node:util` `parseEnv`, not a repo script, so container builds (which do not copy `scripts/`) still resolve the config. - Dev server only: production builds and the server are unchanged. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-side checks (not a substitute for the boxes above): `pnpm check` exit 0 on this branch. A probe loaded `vite.config.ts` through Vite's `loadConfigFromFile` and printed the `/api` target: | Setup | Target | | --- | --- | | no `.env`, no `PORT` | `7860` | | `.env` `PORT=6999`, nothing exported | `6999` (staging: `7860`) | | `.env` 6999, exported `PORT=7001` | `7001` | | `.env` 6999, exported `PORT=` (empty) | `7860` (server: 7860 too) | | `.env` `PORT=6999x` | `6999` (same as `getPort()`) | | `.env` `PORT=` (empty) | `7860` | | `.env` `PORT="6999" # comment` | `6999` | Local CodeRabbit (`--committed --base origin/staging`) on the first commit: 0 findings. Dottore round 1 found the container-build break (the first version imported `scripts/read-launcher-env.mjs`, which the images do not copy) and the raw-string port; both fixed in the second commit. No regression test: `vite.config.ts` has no test harness, and the resolution is a few lines mirroring `getPort()`; the probe above is the proof. ### Manual verification notes - Manually verify: with `PORT=<not 7860>` in the root `.env` and `PORT` not exported, run `pnpm --filter @marinara-engine/client dev` next to a server on that port, open the dev URL, and confirm the app loads data from that server and no build-skew banner appears. - Manually verify: with `PORT` exported in the shell, the exported value still wins over `.env`. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) No docs reference the proxy port, so none were changed. ## UI evidence (if applicable) Not a UI change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:10:26 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#8107
No description provided.