A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hi there,
I am using shopify API to leverage my store/collections/products and I see some discrepancies during the picture uploading process on an existing product:
- If I create a new product, then upload a bunch of images, then attach the corresponding images to product variants - it works fine, all images are being uploaded and everything is ok
- If I need to change a picture of a particular product variant - I am uploading a new one and then update the corresponding product variant changing image_id field in it. In this case it says "image must be for this product".. I dug it a bit deeper and it turned out that when I upload a new image to an existing product - the image immediately vanishes for some reason (not being attached to a product even).
Just uploaded image is available in 0.4s but it then says 404 not found 2s later, see the log:
INFO[2023-02-27 13:42:48.679] Upload image https://<url> INFO[2023-02-27 13:42:51.238] Uploaded. Got image: {"id":40714734403860,"product_id":8140509643028,"position":2,"created_at":"2023-02-27T04:42:50-05:00","updated_at":"2023-02-27T04:42:50-05:00","width":1200,"height":675,"src":"https://cdn.shopify.com/s/files/...<url>"} INFO[2023-02-27 13:42:51.238] Get image [product=8140509643028, id=40714734403860] INFO[2023-02-27 13:42:51.649] Successfully got image: {"id":40714734403860,"product_id":8140509643028,"position":2,"created_at":"2023-02-27T04:42:50-05:00","updated_at":"2023-02-27T04:42:50-05:00","width":1200,"height":675,"src":"https://cdn.shopify.com/s/files/...<url>"}
INFO[2023-02-27 13:42:52.571] Product variant product_id=8140509643028, image_id=40714734403860 INFO[2023-02-27 13:42:52.980] Existing variant image id=40714631938324 INFO[2023-02-27 13:42:53.389] Get image [product=8140509643028, id=40714734403860]
ERRO[2023-02-27 13:42:53.478] Error: Get image failed: Not Found
What is wrong here? Why the image is not attached to a product? Why it is available right away but not found 2 sec later?
Solved! Go to the solution
This is an accepted solution.
Closing it. It turns out the issue on my side: The product is being accidentally updated without a new image, that's why it was deleted every time. Fixed.
This is an accepted solution.
Closing it. It turns out the issue on my side: The product is being accidentally updated without a new image, that's why it was deleted every time. Fixed.