Skip to content

fix: serve client SPA from the correct path in the Docker image#5

Merged
StrandedTurtle merged 1 commit into
mainfrom
claude/fix-spa-static-path
Jun 25, 2026
Merged

fix: serve client SPA from the correct path in the Docker image#5
StrandedTurtle merged 1 commit into
mainfrom
claude/fix-spa-static-path

Conversation

@StrandedTurtle

Copy link
Copy Markdown
Owner

Summary

  • Real-server test surfaced "Cannot GET /" (blank page) when opening the deployed app, despite /api/health working fine.
  • Root cause: server/src/index.js resolves the client dist directory as path.join(__dirname, '..', '..', 'client', 'dist'), assuming server/src and client/dist are siblings under one root. The Dockerfile flattened server/src to /app/src, so that math landed on /client/dist instead of /app/client/dist — matching the log line the user saw (No client build found at /client/dist).
  • Fix: change the image layout to mirror the repo (/app/server/src, /app/client/dist) instead of changing the path math, so local dev and the container resolve identically.

Test plan

  • cd server && node --test — 60/60 passing
  • cd client && npm run build — clean build
  • Verified the __dirname math resolves to /app/client/dist for the new image layout and <repo>/client/dist for local dev (script-checked, no Docker daemon available in this environment)
  • User to re-pull :edge after merge and confirm the dashboard loads in browser

Generated by Claude Code

server/src/index.js derives the client dist directory from __dirname
relative to its own location, expecting the on-disk layout to match the
repo (server/src and client/dist as siblings under one root). The
Dockerfile instead flattened server/src to /app/src, so that math
overshot to /client/dist instead of /app/client/dist — the running
container always logged "No client build found" and served nothing for
non-API routes ("Cannot GET /" in the browser, though /api/health still
worked fine).

Fix the image layout to mirror the repo instead of changing the path
math, so local dev and the container resolve identically.
@StrandedTurtle StrandedTurtle merged commit c5c6084 into main Jun 25, 2026
4 checks passed
@StrandedTurtle StrandedTurtle deleted the claude/fix-spa-static-path branch June 27, 2026 21:07
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