fix(web): force dynamic rendering for runtime env injection #437

Merged
jason.woltje merged 1 commits from fix/runtime-env-dynamic into main 2026-02-22 03:54:13 +00:00
Owner

Summary

  • layout.tsx uses process.env[key] inside runtimeEnvScript() to inject runtime env vars into window.__MOSAIC_ENV__
  • Next.js pre-renders the root layout at build time, so process.env captures the CI build-arg value (api.mosaicstack.dev) instead of the Docker runtime env var (mosaic-api.woltje.com)
  • Adding export const dynamic = "force-dynamic" forces per-request rendering so container env vars are read at runtime

Test plan

  • All 1132 unit tests pass
  • Pre-commit hooks pass (prettier, lint, typecheck)
  • CI pipeline green
  • Verify window.__MOSAIC_ENV__ contains runtime value after deployment
## Summary - `layout.tsx` uses `process.env[key]` inside `runtimeEnvScript()` to inject runtime env vars into `window.__MOSAIC_ENV__` - Next.js pre-renders the root layout at build time, so `process.env` captures the CI build-arg value (`api.mosaicstack.dev`) instead of the Docker runtime env var (`mosaic-api.woltje.com`) - Adding `export const dynamic = "force-dynamic"` forces per-request rendering so container env vars are read at runtime ## Test plan - [x] All 1132 unit tests pass - [x] Pre-commit hooks pass (prettier, lint, typecheck) - [ ] CI pipeline green - [ ] Verify `window.__MOSAIC_ENV__` contains runtime value after deployment
jason.woltje added 1 commit 2026-02-22 03:51:53 +00:00
fix(web): force dynamic rendering for runtime env injection
All checks were successful
ci/woodpecker/push/web Pipeline was successful
f42d1fb83f
Next.js pre-renders the root layout at build time, causing
process.env reads in runtimeEnvScript() to capture CI build-arg
values instead of Docker runtime env vars. Adding force-dynamic
ensures the layout renders per-request so container env vars
(like NEXT_PUBLIC_API_URL) are read at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jason.woltje merged commit 06e54328d5 into main 2026-02-22 03:54:13 +00:00
jason.woltje deleted branch fix/runtime-env-dynamic 2026-02-22 03:54:13 +00:00
Sign in to join this conversation.