JaveScript Asset 404 Error after Asset Optimization Feature Enabled

In my recent deployment on Netlify, my icon assets are missing after the deployment. After comparing with my local version and GitHub Pages version, I found the issue only happens on Netlify.

The issue comes from Asset Optimization. When this feature is enabled in the deployment settings, a file named framework-caa722f8.js will be redirected to CloudFront, and caused a 404 error.

Associated website: https://hut.ao
Associated GitHub Discussion (with screenshots): https://github.com/orgs/vuepress-theme-hope/discussions/2987

Hey,

Thank you for pointing out this issue. Is there a reason that turning off Asset Optimization does not work for you? maybe we can find a workaround.

No, the issue only happens when Asset Optimization is set to enable. I have already disabled it on my site.

Hi @Masterain :wave:t6: ,

Would you mind sharing a deploy that had asset optimisation enabled?

Enabled. Currently 404 error comes again.

As the setting will immediately affect the production environment, I have disabled it again, but surely the issue is coming from the asset optimization. The GitHub discussion link included at the top of the thread has given sufficient proof.

We just need the link of an old deployment that has this enabled so we can check. Each deploy gets is own unique permalink, so you could share that.

You can try the following:

The link that has the error: https://64301461e5d17c0008d0b5c2–snaphutao.netlify.app/en/

The link is working well: https://643236c36502fb44fda76f3d–snaphutao.netlify.app/en/

I just replied with two links, but the spam filter hides it. You can check that comment.

Just like I expected, the error has nothing to do with Netlify. The issue is happening because your script app-843bbcab.js requests framework-caa722f8.js from the origin that served app-843bbcab.js.

Since app-843bbcab.js was served by example.server.com, framework-caa722f8.js is also requested from example.server.com. However, the file doesn’t exist there. Netlify’s asset processing can dynamically host files anywhere, so this is expected to break.

In any case, since you’re already using Vite, I don’t see why you need asset processing. Vite should already be able to bundle the files for you.