FIXED: monologue about a chunk not found errors
I'm getting
chunk not found
error's on some pages in the production
environment specifically with custom domains.3 Replies
browser console:
GET https://site/_next/static/chunks/490-3e704f173ad69c33.js net::ERR_ABORTED 404 (Not Found)
Refused to execute script from 'https://site/_next/static/chunks/490-3e704f173ad69c33.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
ChunkLoadError: Loading chunk 490 failed.
but like I said, it only happens on the custom domain I set up for that pages project
the preview and production deploys work on the cloudflare-provided domains
and it's only a specific group of pages/routes. the rest work as intended
not sure if something changed under the hood (vercel version used or something). It started happening out of nowhere.
also, re-deploying doesn't fix the problem atm
The content-type on the custom domain for ONLY for that chunk is text/html
the rest is fine.
In the cloudflare-provided domains the content-type for that chunk is correct application/javascript
I fixed it
I noticed the response had the Cf-Cache-Status: HIT
header
I purged that url manually and now it works
It returns with the correct Content-Type
Still weird that it had a cached version with the content type set to text/html
I don't have any rules that affect the domain used in Cloudflare Pages
No cache rules, no page rules...
No cache reserve
Caching level is set to standard
The zone is on the free plan so it doesn't have any fancy stuffRunning into what seems like the same issue. Hosting a nextjs app on pages with a custom domain. How should we configure the cache? We're currently using the Standard Caching Level for the custom domain