Refused to execute script because its MIME type ('text/html') is not executable
Hey,
I deployed my next.js site with clerkdev authentication on cloudflare. I get this error in console only when user is logged in.
Failed to load resource: the server responded with a status of 404 ()
Refused to execute script from 'https://[mydomain]/_next/static/chunks/webpack-0342d472777da1c1.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
So, once the user is log in, instead of sign in button, I show sign out button, but the signout button is not visible to user and I get this error.
Locally, the code is working perfectly.
Strangely, I also have other site deployed on cloudflare with similar code & I get no error there.
4 Replies
Fixed:
I changed all package version to my previous project and it started working.
When you say you changed package versions to fix it, do you mind if I ask which versions specifically you changed?
I changed all, so don't specifically know the exact cause. I could be either clerk or nextjs I think. Below ones are working
NODE_VERSION=19.9.0
on cloudflareI had a similar issue. I don't remember exactly what fixed it, but I think it was related to my script not compiling, having an error, or being named wrong or something. Might be unreated, i don't know JS well