Skip to content

Fix 404 and MIME type errors for script execution on codeex-ai.netlify.app#12

Open
netlify-coding[bot] wants to merge 1 commit intomainfrom
agent-on-codeex-ainetlifyapp-5ed6
Open

Fix 404 and MIME type errors for script execution on codeex-ai.netlify.app#12
netlify-coding[bot] wants to merge 1 commit intomainfrom
agent-on-codeex-ainetlifyapp-5ed6

Conversation

@netlify-coding
Copy link

🔗 View agent run: https://app.netlify.com/projects/codeex-ai/agent-runs/69a197e36866a138e3d05ed6

🤖 Agent: Claude

💬 Prompt: solve this problem login:1 GET https://codeex-ai.netlify.app/_next/static/chunks/4894-52ca501073566720.js net::ERR_ABORTED 404 (Not Found)
Refused to execute script from '' because its MIME type ('text/html') is not executable, and strict MIME ...

Result: The 404 errors for Next.js JavaScript chunks (e.g., 4894-52ca501073566720.js, app/login/page-0de246bcacbf2905.js) and the resulting MIME type / ChunkLoadError failures were caused by the PWA service worker configuration serving stale cached content after deployments.

Three specific issues were identified and fixed:

1. Stale JS chunk caching strategy (next.config.js): The @ducanh2912/next-pwa service worker was configured with CacheFirst for /_next/static JavaScript files. This meant the service worker would serve JS chunks from its cache without checking the network. After a new deployment with new chunk hashes, users with the old service worker would have their requests for new chunks fail because the old chunk URLs no longer existed on the server. The strategy was changed to StaleWhileRevalidate, which serves cached content immediately but also fetches the latest version from the network in the background, ensuring caches stay fresh.

2. Aggressive frontend navigation caching (next.config.js): Both cacheOnFrontEndNav and aggressiveFrontEndNavCaching were set to true, causing the service worker to aggressively cache HTML navigation responses. These cached HTML pages contained references to chunk hashes from old builds, which would then 404 when the browser tried to load them after a redeployment. Both settings were disabled.

3. Stale generated service worker files committed to git (.gitignore + file removal): The PWA plugin generates sw.js, workbox-*.js, swe-worker-*.js, and fallback-*.js files into the public/ directory during each build. These files were committed to git with hardcoded precache entries referencing specific chunk hashes from a previous build. This created a mismatch between the precache manifest and the actual chunks produced by new builds. The stale files were removed from git tracking and added to .gitignore so the PWA plugin generates them fresh on every build. An explicit cleanupOutdatedCaches: true option was also added to the workbox configuration to ensure outdated precached entries are properly cleaned up in user browsers.

@vercel
Copy link

vercel bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codeex-ai Error Error Feb 27, 2026 1:22pm

@netlify
Copy link

netlify bot commented Feb 27, 2026

Deploy Preview for codeex-ai ready!

Name Link
🔨 Latest commit 93b40ed
🔍 Latest deploy log https://app.netlify.com/projects/codeex-ai/deploys/69a19a4abb86cb0008cff1cf
😎 Deploy Preview https://deploy-preview-12--codeex-ai.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Feb 27, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
❌ Deployment failed
View logs
codeex-ai 93b40ed Feb 27 2026, 01:25 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants