fix(docker): make frontend accessible for PDF generation#724
Conversation
- Update start.sh to pass HOSTNAME=0.0.0.0 and PORT to Next.js server - Allow frontend to bind correctly inside single-container setup - Fix backend -> frontend communication (resume PDF export 503 error) - Support dynamic port via environment variables
|
|
||
| trap '' SIGTERM SIGINT SIGQUIT | ||
| node server.js "$@" & | ||
| HOSTNAME=0.0.0.0 PORT="${FRONTEND_PORT}" node server.js "$@" & |
There was a problem hiding this comment.
SUGGESTION: Redundant PORT assignment
The inline PORT="${FRONTEND_PORT}" is redundant since export PORT="${FRONTEND_PORT}" already sets this environment variable on line 236. The subshell inherits all exported variables, so this inline assignment is unnecessary.
Consider simplifying to:
| HOSTNAME=0.0.0.0 PORT="${FRONTEND_PORT}" node server.js "$@" & | |
| HOSTNAME=0.0.0.0 node server.js "$@" & |
This keeps the critical HOSTNAME=0.0.0.0 fix (which is the actual solution to the 503 error) while removing the duplication.
Code Review SummaryStatus: No Issues Found | Recommendation: Merge OverviewThis PR correctly fixes the 503 error during PDF generation in Docker by adding Key observations:
Files Reviewed (1 file)
Previous inline comment on redundant PORT assignment is now outdated - the author addressed it in commit 2d0aac9. Reviewed by claude-4.5-opus-20251124 · 99,427 tokens |
There was a problem hiding this comment.
No issues found across 1 file
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
Pull Request Title
Cannot connect to frontend for PDF generation
Related Issue
Description
I just cloned the repo today and started using
docker compose up -d, when i tried to download the PDF i get this 503 error{"detail":"Cannot connect to frontend for PDF generation. Attempted URL: http://localhost:3000/print/resumes/adabad6e-e484-467f-aa44-54ba0377e448?template=swiss-single&pageSize=A4&marginTop=10&marginBottom=10&marginLeft=10&marginRight=10§ionSpacing=3&itemSpacing=2&lineHeight=3&fontSize=3&headerScale=3&headerFont=serif&bodyFont=sans-serif&compactMode=false&showContactIcons=false&accentColor=blue&lang=en. Please ensure: 1) The frontend is running, 2) The FRONTEND_BASE_URL environment variable in the backend .env file matches the URL where your frontend is accessible."}Type
Proposed Changes
Screenshots / Code Snippets (if applicable)
How to Test
Checklist
Additional Information
copilot:walkthrough
Summary by cubic
Fixes 503 errors during PDF generation in Docker by making the frontend reachable from the backend. The Next.js server now binds to 0.0.0.0 on the configured port via exported env vars.
HOSTNAME="0.0.0.0"andPORT="$FRONTEND_PORT"indocker/start.shfor the Next.js standalone server.Written for commit 2d0aac9. Summary will update on new commits.