cli: [Bug]: Images don't load with new CDN URL in theme dev environment (shopify theme dev)
Please confirm that you have:
- Searched existing issues to see if your issue is a duplicate. (If you’ve found a duplicate issue, feel free to add additional information in a comment on it.)
- Reproduced the issue in the latest CLI version.
In which of these areas are you experiencing a problem?
Theme
Expected behavior
New CDN URLs are being implemented for some Shopify stores it seems.
All images and asset URLs generated by the appropriate liquid filter used to have a prefix like:
//cdn.shopify.com/s/files/.../products/
But now, for some stores, they’re like this:
/cdn/shop/products/
This brings with it additional problems which are already affecting many stores I’ve checked. I’ve detailed them in a separate issue in the Shopify Liquid repo, which gets little to no attention it seems: https://github.com/Shopify/liquid/issues/1708 If someone could get the attention of someone who can help, please link them to this issue.
However, this issue is specifically regarding the image assets loaded in shopify-cli dev.
A new CDN image URL looks like this:
/cdn/shop/files/the-name-of-your-image.jpg
Which the browser resolves to:
http://127.0.0.1:9292/cdn/shop/files/the-name-of-your-image.jpg
It would appear localhost will serve a 200 response but invalid image data so no image loads.
I’ve confirmed that some other theme devs have started experiencing this within the last 1-2 days.
However other assets like JavaScript and stylesheets and the like are served correctly through the new CDN URLs.
The only way to fix it currently is to prepend every image_url output with shop.url
Actual behavior
Images don’t load.
Verbose output
-
Reproduction steps
You need to have a Shopify store that uses the new CDN URLs. It seems most stores are still using the old CDN URLs as mentioned earlier.
Operating System
Windows 11
Shopify CLI version (check your project’s package.json if you’re not sure)
3.45.1
Shell
No response
Node version (run node -v if you’re not sure)
No response
What language and version are you using in your application?
No response
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (7 by maintainers)
@Arkham Not sure if this is related to the bug, but if I try and load a section containing images with a ?sections=… AJAX call, all the images come back as
//cdn.shopifystill. It’s been 2 days since I first noticed the bug, is the AJAX call returning a cached response? If so, why is the cache not getting cleared after a sufficient time? Or is this also a bug?