fix(prod): respect LOCAL_PORT + anchor public write paths to __dirname - #115
Merged
Conversation
Fixes 2 real bugs found live while building Docker support (add-docker-support, #24), both surfaced by testing a minimal production image that has no src/ tree — but both affect the real Render production deploy too, not just Docker. 1. src/server.ts:135 (fix-prod-port-ignores-local-port) — production always hardcoded port 3008, silently ignoring LOCAL_PORT. Now respects LOCAL_PORT whenever it's actually set, in any environment; still defaults to 3001 dev / 3008 prod when unset, so a deploy that's never set LOCAL_PORT keeps its current port unchanged. 2. src/services/createPDF.ts, uploadCV.middleware.ts, uploadImages.middleware.ts (fix-hardcoded-src-public-write-paths) — all 3 wrote to a bare relative `src/public/...` literal (CWD-relative, not __dirname-relative), which never matches what express.static(path.join(__dirname, 'public')) actually serves in a compiled run (dist/public/...). PDF export hard-crashed (ENOENT, Puppeteer doesn't auto-create dirs); CV/image uploads silently "succeeded" into a directory nothing serves, 404ing forever on their own returned URL. Now all 3 resolve off __dirname, matching express.static exactly in both dev and compiled runs. docker-compose.prod.yml and Dockerfile's HEALTHCHECK reverted from the add-docker-support round-2 hardcoded-3008 workaround back to LOCAL_PORT-templating (now safe); Dockerfile's mkdir -p src/public/... workaround removed (no longer needed — all 3 paths now self-create under the correct dist/public/... location). - npm run build: clean (tsc && npm run copy) - npm test: 13 suites / 77 tests passed (unchanged — no Jest coverage for these paths; acceptance verified via live Docker container testing instead, see evidence) - Live-verified in Docker production target: LOCAL_PORT unset still defaults to 3008 (no regression); LOCAL_PORT set to a non-default value is genuinely respected and reaches healthy; PDF export, image upload+fetch, and CV upload+download all confirmed working end-to-end with byte-identical file round trips, with src/ confirmed absent from the image (rules out "worked by accident") Nodes: fix-prod-port-ignores-local-port (SEALED), fix-hardcoded-src-public-write-paths (SEALED) Evidence: agent-hub/evidence/implementer/2026-09-06/fix-prod-port-ignores-local-port-diff.md, agent-hub/evidence/verifier/2026-09-06/fix-prod-port-ignores-local-port-seal.md, agent-hub/evidence/implementer/2026-09-06/fix-hardcoded-src-public-write-paths-diff.md, agent-hub/evidence/verifier/2026-09-06/fix-hardcoded-src-public-write-paths-seal.md Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
e003ec3 fix(prod): respect LOCAL_PORT + anchor public write paths to __dirname
Fixes 2 real bugs found live while building Docker support (#24), both surfaced by testing a minimal production image with no
src/tree — but both affect the real Render production deploy too, not just Docker.src/server.ts— production always hardcoded port 3008, silently ignoringLOCAL_PORT. Now respects it when set, still defaults to 3001 dev / 3008 prod when unset.createPDF.ts/uploadCV.middleware.ts/uploadImages.middleware.ts— all 3 wrote to a bare relativesrc/public/...path that never matched whatexpress.staticactually serves in a compiled run. PDF export hard-crashed; CV/image uploads silently 404'd forever on their own returned URL. Now all 3 resolve off__dirname.Nodes:
fix-prod-port-ignores-local-port(SEALED),fix-hardcoded-src-public-write-paths(SEALED) — both live-verified end-to-end in Docker (see evidence notes in the commit).