JavaScript bundle files were being truncated to 1,398 bytes when deployed through GitHub Actions CI/CD pipeline, causing Uncaught SyntaxError: Invalid or unexpected token errors on the live site.
Expected: vendor-three-C2c03BIj.js should be 655,212 bytes
Actual (via CI): File was truncated to 1,398 bytes
The issue occurs specifically in the GitHub Actions environment when pushing to the gh-pages branch. The exact cause is likely:
- Git LFS interference: Even with LFS disabled in the workflow, GitHub's infrastructure may have LFS configurations that affect large file handling
- Actions artifact size limits: The
actions/upload-pages-artifact@v4and similar actions have issues with files >500KB - CI environment git configuration: Some git filters or hooks in the Actions environment cause truncation during push operations
A manual deployment script successfully bypasses all CI issues:
npm run deploy:manualScript: scripts/deploy-manual.sh
- ✅ Builds production locally (
npm run build:prod) - ✅ Initializes a clean git repo in
dist/ - ✅ Completely disables Git LFS and line-ending conversions
- ✅ Verifies file sizes in git's index match filesystem
- ✅ Commits and force-pushes to
gh-pagesbranch - ✅ Verifies files on GitHub after push
- Runs in local environment without CI restrictions
- Direct git push without intermediary actions/artifacts
- Full control over git configuration
- No action size limits or hidden filters
| Method | Status | File Size | Notes |
|---|---|---|---|
| Manual Script | ✅ WORKS | 655,212 bytes | Recommended for production |
peaceiris/actions-gh-pages@v3 |
❌ Fails | 1,398 bytes | Truncates large files |
actions/upload-pages-artifact@v4 |
❌ Fails | 1,398 bytes | Size limit issues |
Direct git push in CI |
❌ Fails | 1,398 bytes | CI environment issue |
| Chunked push (per-file) | ❌ Fails | 1,398 bytes | Still truncates in CI |
- ❌ Code splitting - Helped reduce bundle size but didn't fix truncation
- ❌ Pre-compression -
.gzfiles still truncated - ❌ Disabling LFS in workflow - CI environment still had issues
- ❌ Binary file marking - Prevented git from reading content at all
- ❌ Chunked commits - Each file still truncated during CI push
- ❌ Different GitHub Actions - All had same truncation issue
# Use manual deployment script
npm run deploy:manual- Continue using CI for validation and checks
- Use manual deployment for actual releases
- CI workflow can still run tests, linting, and build verification
To eventually enable CI deployment, investigate:
- GitHub support ticket - This may be a platform issue
- Alternative hosting - Consider Vercel, Netlify, or Cloudflare Pages
- CDN preprocessing - Upload to CDN directly, bypass git
- Git submodules - Separate large assets from main repo
Check file size on live site:
curl -sI https://khalilcharfi.github.io/assets/vendor-three-C2c03BIj.js | grep content-length
# Should return: content-length: 655212Check file in gh-pages branch:
git fetch origin gh-pages
git show origin/gh-pages:assets/vendor-three-C2c03BIj.js | wc -c
# Should return: 655212- Initial Error: Build failed due to missing
chatbotConfig.ts - Syntax Error: Deployed site showing JS syntax errors
- Discovery: Files truncated to 1,398 bytes on live site
- Investigation: Tried code splitting, compression, LFS disabling
- Root Cause: Issue isolated to CI environment only
- Solution: Manual deployment script successfully deployed full files
✅ Manual deployment verified working:
- Build completes: 655KB bundle created
- Git staging: 655KB in git index
- GitHub push: 655KB in gh-pages branch
- Live site: 655KB file served
- Site loads: No JavaScript errors
Last Updated: 2025-10-12
Status: Manual deployment working, CI deployment blocked by platform issue