2.7 KiB
2.7 KiB
Iteration Log - 2026-07-24-1052 - Deployment Static Assets Omission Fix (Ad-hoc)
Request
The user reported that the dashboard overview screen still could not be opened and crashed immediately on entering credentials.
Steps Taken
- Systematic Asset Check:
- Developed a TDD test test-all-assets.js to programmatically scan and download all preloaded dynamic stylesheets and JavaScript chunks fetched by
/loginon the production server. - Discovered that chunk file
/_next/static/chunks/2p64h4x46qcn0.jsreturned a404 Not Foundon the server, although it existed locally.
- Developed a TDD test test-all-assets.js to programmatically scan and download all preloaded dynamic stylesheets and JavaScript chunks fetched by
- Deployment Bug Found:
- Examined deploy-sftp.js and realized that neither
.next/static(which holds all JS and CSS chunks) norpublic(which holds assets like images, icons, and fonts) was included in theUPLOAD_MANIFEST. - The server was running on obsolete static assets, mismatching the newly built server bundles, causing direct chunk loading failures.
- Examined deploy-sftp.js and realized that neither
- TDD Setup & Fix:
- Created sftp_manifest_test.js asserting that
scripts/deploy-sftp.jsincludes.next/staticin its upload list. - Confirmed the test failed initially.
- Appended
{ local: '.next/static', remote: '.next/static', type: 'dir' }and{ local: 'public', remote: 'public', type: 'dir' }to theUPLOAD_MANIFESTarray inscripts/deploy-sftp.js. - Re-ran
node test/sftp_manifest_test.jswhich successfully passed.
- Created sftp_manifest_test.js asserting that
- Build and Deployment:
- Compiled Next.js locally (
npm run build). - Ran
node scripts/deploy-sftp.jswhich successfully uploaded 33 groups of files (including the entire.next/staticfolder) and reloaded PM2.
- Compiled Next.js locally (
- Validation:
- Re-ran the automated asset verification test
node test/test-all-assets.js. - Result:
=== Verification Complete: 14 passed, 0 failed ===. The previously missing chunk2p64h4x46qcn0.jsresolved successfully with200 OK(6358 bytes). - Ran
node test/fetch-remote-dashboard.jsverifying successful login and load of the overview page/with200 OK.
- Re-ran the automated asset verification test
Current State
- The deployment process has been fixed and now uploads all static chunk resources and public assets correctly.
- All dynamic JS chunks resolve on the production server with
200 OK. - The dashboard is 100% accessible.
Considerations for Next Time
- Deployments of Next.js standalone applications must always couple
.next/standaloneserver builds with.next/staticstatic files to prevent runtime chunk load failures.