Files
Deep-Package-Inspection/docs/log/2026-07-24-0955-bugfix.md
T

2.0 KiB

Iteration Log - 2026-07-24-0955 - Bug Fix (Ad-hoc Request)

Request

The user reported that the page failed to load ("This page couldn't load" screen) after the recent changes to user roles and sidebar menus.

Steps Taken

  1. Root Cause Analysis:
    • Checked the backend error logs and found no backend uncaught exceptions.
    • Checked localhost:3000 on the server; the Next.js server was correctly redirecting requests without cookies to /login with a 307 Temporary Redirect status, and returning a 200 OK status for the /login page.
    • Determined that the "This page couldn't load" screen with "Reload" and "Back" buttons is a standard Next.js client-side chunk loading error. It occurs because new compiler chunk hashes were generated during the deployment build, while the user's browser was still holding onto outdated chunk references from the active session.
  2. Configuration Cleanups:
    • Corrected Next.js 16's middleware setup by renaming src/middleware.ts back to src/proxy.ts (exporting a proxy function) to follow the latest Next.js 16 specification and eliminate compiler warnings.
    • Built the Next.js frontend project locally to ensure no compiler warnings or TypeScript issues.
  3. Deployment:
    • Executed the SFTP deployment script node scripts/deploy-sftp.js to transfer built standalone assets and updated backend scripts to the production server.
    • Reloaded all PM2 processes (backone-frontend, backone-backend, and backone-proxy).

Current State

  • The frontend Next.js server compiles cleanly and operates without errors.
  • Routing middleware correctly handles request checks.
  • The Agents menu option has been restored for TENANT_ADMIN role users.
  • View-as history logs are properly filtered to prevent TENANT_ADMIN from seeing logs from SUPER_ADMIN.

Considerations for Next Time

  • When deploying new Next.js production builds, client browsers with open tabs of the dashboard might experience temporary chunk load errors until they refresh. The built-in Next.js handler provides a "Reload" button to recover.