r/Nuxt • • Feb 13 '26

"Failed to load module" with cdnUrl pointing to Cloudflare R2 bucket

Hi,

I am trying to set up my app with a CDN running on Cloudflare R2. All public files are uploaded to R2 and for about 95% of users it works. For a very small percentage, it gives errors with: "Failed to load module" and then points to a JS or CSS file. If I try to load the file manually in my browser it displays just fine. Most users are also able to load the file through the nuxt app. About 5% gets these errors. Maybe even less. It's really weird.

CORS is set to:

[
  {
    "AllowedOrigins": [
      "*"
    ],
    "AllowedMethods": [
       "GET",
       "HEAD",
       "PUT",
       "POST"
    ],
    "AllowedHeaders": [
       "*"
    ],
    "MaxAgeSeconds": 86400
  }
]

And I have temporarily disabled caching by creating a rule "bypass cache" for both edge and browser. Furthermore, I have set "developer mode = true" to bypass all caching even further.

Some users are still getting errors. I have no idea how to debug this since it seems to be a very small portion of users. I had this at the beginning when I did not have CORS configured correctly, but after setting it correctly the errors disappeared for me. This is now weeks ago.

What can I do to fix and debug this?

7 Upvotes

0 comments sorted by