Dedicated to the Hydrogen framework, headless commerce, and building custom storefronts using the Storefront API.
I am getting back image URLs from the Storefront API that point to non-existent files on the Shopify CDN.
I'm not going to post shop details in a public forum, so how can I get help with this apparent Shopify error? I tried partner support and they (unhelpfully) pointed me to these public forums.
Thanks.
What can you post? This is a community forum so we'd need a little bit to work with. Do understand that you might not want to add all the details here so maybe throw them into a github gist or something that you delete later.
Are you sure it's a non existent url? is it the version number that's wrong? missing? something else?
We use the Storefront API transformedSrc field to get Shopify CDN image URLs. For at least one shop, many of these URLs lead to a CDN 404 error.
As far as I understand, an invalid URL from this field is either an API error or a CDN error. The transformations are best-effort, but they're ignored if unsupported; and for this shop, simply requesting transformedSrc with no transformations still leads to a 404 error page.
The query is very simple:
query ($id: ID!) {
product: node(id: $id) {
... on Product {
id
images(first: 1) {
edges {
node {
id
originalSrc
transformedSrc(maxWidth: 128, maxHeight: 128)
}
}
}
}
}
}
Example of a bad transformedSrc URL returned by the Storefront API: https://cdn.shopify.com/s/files/1/0670/1711/products/4121_nickel_mach3_128x128.jpg?v=1601313804
I expect Shopify needs to look into this to determine whether the API or the CDN is at fault.
Hey @sigh,
We did a bit of digging with the info you shared. Based on this specific behaviour, and intended functionality of how images are hosted, this would not be directly related to the our Storefront API. I would suggest reaching out to a merchant experiencing this types of issue, and encourage them to contact our support team directly - feel free to share this link.
awwdam | API Support @ Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog