Remix app getting sporadic 404s on assets that are in the deployment

We are encountering a weird and hard to debug/reproduce behaviour on our deployed remix app on cloudflare pages, sometimes the build assets (/assets/<filename>.js) are suddenly no longer found. The requests for the assets are going through to the remix app loaders which tries to resolve them as a page (in a catch all route) even though they should never reach that stage since the files are present in the deployment, I can also find them in the detail view of the deployment in cloudflare pages. The strange part is that these deployed builds are working fine (since usually after a deploy a manual test is done) but after some time, out of the blue, these errors occur where the assets are not found and they also seem to resolve itself making it very hard to debug. In case this could be relevant, we generate a build in our ci/cd pipeline and upload the build with the wrangler command. Can anyone steer me in the right direction of where I can even begin my search for the issue? Should I be looking into the direction of a cloudflare pages bug/hickup or in the direction of a remix bug?
1 Reply
Clown Studios
Clown Studios5w ago
this sounds like a caching or routing issue. cloudflare pages might be caching old assets or misrouting requests intermittently, causing your remix app to handle asset requests as routes. you can try tweaking your cache settings to ensure assets aren’t incorrectly cached, or implement cache busting by adding versioning to asset filenames. also, check your remix route configuration to make sure asset routes aren’t accidentally falling through to your catch-all route. since it’s hard to reproduce, it might be worth looking into any cache invalidation or purging strategies in your ci/cd pipeline as well.
Want results from more Discord servers?
Add your server