Asset_url leads to a 404 error

Solved
Ultrabender
Excursionist
20 2 11

Hello,

Without my understanding why, I found myself full of 404s on my site (image, script, etc.)

I tried to find where the problem was coming from and found that the asset_url tag itself didn't seem to work, at least it didn't lead to my files. Here is an example :

In theme.liquid, I have this line:

 

{{ 'jquery.min.js' | asset_url | script_tag }}

 

When I display my theme, this is what I get:

 

<script src="//cdn.shopify.com/s/files/1/0097/4192/6485/t/27/assets/jquery.min.js?26017" type="text/javascript"></script>

 

Except that this leads, you will understand, to a 404.

I admit that I do not understand how this is possible and why all of a sudden it no longer works.

Is there a way to "regenerate" the asset_url, or something like that?

Thanks a lot.

0 Likes
Ultrabender
Excursionist
20 2 11

This is an accepted solution.

While I was doing my tests, some asset URLs started to change, without me doing anything. t/27 became t/10 and the files were accessible again. But not all. Mind-blowing.

After tearing my hair out for a few hours. I solved the problem in the following way:

  1. I created a .zip file of my theme that no longer worked (the one with problem with asset_url) without changing any line of code
  2. I created a "new" theme from this .zip file. I published it.
  3. It works, no more 404 problem.

Hope this helps someone.

Thank you Shopify 🤷‍

0 Likes