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
Open
Fix 404 and MIME type errors for script execution on codeex-ai.netlify.app#12netlify-coding[bot] wants to merge 1 commit intomainfrom
netlify-coding[bot] wants to merge 1 commit intomainfrom
Conversation
…y.app (69a197e36866a138e3d05ed6)
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
✅ Deploy Preview for codeex-ai ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
codeex-ai | 93b40ed | Feb 27 2026, 01:25 PM |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 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-pwaservice worker was configured withCacheFirstfor/_next/staticJavaScript 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 toStaleWhileRevalidate, 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): BothcacheOnFrontEndNavandaggressiveFrontEndNavCachingwere set totrue, 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 generatessw.js,workbox-*.js,swe-worker-*.js, andfallback-*.jsfiles into thepublic/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.gitignoreso the PWA plugin generates them fresh on every build. An explicitcleanupOutdatedCaches: trueoption was also added to the workbox configuration to ensure outdated precached entries are properly cleaned up in user browsers.