Skip to content

fix(ci): write .env.prod (not .env.production) so the prod build finds its env#37

Merged
samutpra merged 1 commit into
mainfrom
fix/deploy-env-prod-filename
Jul 16, 2026
Merged

fix(ci): write .env.prod (not .env.production) so the prod build finds its env#37
samutpra merged 1 commit into
mainfrom
fix/deploy-env-prod-filename

Conversation

@samutpra

Copy link
Copy Markdown
Contributor

Problem

The GCP deploy workflow fails at build with:

Error: [env] Missing REACT_APP_API_BASE_URL, REACT_APP_API_APP_ID for mode "prod".
Expected in .env.prod (or the process environment).

scripts/deploy-gcs.sh runs bun run build:prodvite build --mode prod, and Vite --mode prod loads .env.prod. But the workflow's "Write .env.production" step created .env.production — a filename Vite never loads for mode prod — so the env file was silently ignored and the vite.config.ts guard threw.

Left over from the env refactor (#33) that renamed .env.production.env.prod and switched every script to an explicit --mode; deploy-gcs.yml and the deploy-gcs.sh comment still referenced the old name.

Fix

  • Workflow writes .env.prod (matching what --mode prod loads).
  • Update the stale comments in the workflow and deploy-gcs.sh.

Verification

bun run build:prod succeeds locally with a .env.prod present (✓ built in ~4s), confirming the filename is what the prod build resolves.

Note

Repo Variables REACT_APP_API_BASE_URL / REACT_APP_API_APP_ID must be set under Settings → Secrets and variables → Actions → Variables (trusted, admin-set config — not attacker-controllable event input). The workflow is workflow_dispatch only (manual), so this does not run on merge.

🤖 Generated with Claude Code

…s its env

`build:prod` runs `vite build --mode prod`, which loads `.env.prod`. The deploy
workflow wrote `.env.production` — a name Vite never loads for mode "prod" — so
the file was ignored and the build failed the env guard:

    Error: [env] Missing REACT_APP_API_BASE_URL, REACT_APP_API_APP_ID for mode "prod".

Left over from the env refactor (#33) that renamed .env.production -> .env.prod
and switched to explicit `--mode prod`; the workflow and the deploy-gcs.sh
comment still referenced the old name. Rename the written file to .env.prod and
fix the stale comments.

Verified locally: `bun run build:prod` succeeds with a .env.prod present.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@samutpra
samutpra merged commit 79843fa into main Jul 16, 2026
5 checks passed
@samutpra
samutpra deleted the fix/deploy-env-prod-filename branch July 16, 2026 08:34
samutpra added a commit that referenced this pull request Jul 16, 2026
commit 79843fa
Merge: 203c0cc 00a2a88
Author: Thammanoon Semapru <samutpra@users.noreply.github.com>
Date:   Thu Jul 16 15:34:20 2026 +0700

    Merge pull request #37 from CarmenSoftware-organization/fix/deploy-env-prod-filename

    fix(ci): write .env.prod (not .env.production) so the prod build finds its env

commit 00a2a88
Author: Thammanoon Semapru <samutpra@users.noreply.github.com>
Date:   Thu Jul 16 15:32:45 2026 +0700

    fix(ci): write .env.prod (not .env.production) so the prod build finds its env

    `build:prod` runs `vite build --mode prod`, which loads `.env.prod`. The deploy
    workflow wrote `.env.production` — a name Vite never loads for mode "prod" — so
    the file was ignored and the build failed the env guard:

        Error: [env] Missing REACT_APP_API_BASE_URL, REACT_APP_API_APP_ID for mode "prod".

    Left over from the env refactor (#33) that renamed .env.production -> .env.prod
    and switched to explicit `--mode prod`; the workflow and the deploy-gcs.sh
    comment still referenced the old name. Rename the written file to .env.prod and
    fix the stale comments.

    Verified locally: `bun run build:prod` succeeds with a .env.prod present.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

commit 203c0cc
Author: Thammanoon Semapru <samutpra@users.noreply.github.com>
Date:   Thu Jul 16 15:27:36 2026 +0700

    chore: rename .env.uat to .env.production in GCS deployment workflow

commit 84b711e
Author: Thammanoon Semapru <samutpra@users.noreply.github.com>
Date:   Thu Jul 16 15:24:47 2026 +0700

    chore: rename generated .env.production to .env.uat in deployment workflow

commit c267613
Author: Thammanoon Semapru <samutpra@users.noreply.github.com>
Date:   Thu Jul 16 15:23:03 2026 +0700

    chore: remove GCP deployment workflow file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant