open-api icon indicating copy to clipboard operation
open-api copied to clipboard

[BUG]: The upload listing image is not returning correct urls belonging to the listing_image_id

Open yovasx2 opened this issue 2 years ago • 11 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Describe the bug

from time to time the endpoint: https://developers.etsy.com/documentation/reference/#operation/uploadListingImage is returning a response mixing URL belonging to a different image, seems to be a race condition in Etsy side, because after a while the https://developers.etsy.com/documentation/reference/#operation/getListingImage returns the correct listing_image_id and the URLs containing that id

Steps to reproduce

We spot a bad response on the fly by setting 3-5 images for a product in a round:

{
   "listing_id":1163106580,
   "listing_image_id":3837624856,
   "hex_code":"918C84",
   "red":145,
   "green":140,
   "blue":132,
   "hue":36,
   "saturation":9,
   "brightness":57,
   "is_black_and_white":false,
   "creation_tsz":1651034039,
   "rank":2,
   "url_75x75":"https://i.etsystatic.com/22076819/r/il/93de17/3659832288/il_75x75.3659832288_jcto.jpg",
   "url_170x135":"https://i.etsystatic.com/22076819/r/il/93de17/3659832288/il_170x135.3659832288_jcto.jpg",
   "url_570xN":"https://i.etsystatic.com/22076819/r/il/93de17/3659832288/il_570xN.3659832288_jcto.jpg",
   "url_fullxfull":"https://i.etsystatic.com/22076819/r/il/93de17/3659832288/il_fullxfull.3659832288_jcto.jpg",
   "full_height":1469,
   "full_width":1469
}

As u can see the URL is referring to 3659832288 but the desired listing_image_id is 3837624856, when u hit get image with 3837624856 the URL is completely different (the correct one).

Expected behavior

POST response must return a consistent response as the GET

Additional context

affected listing to search in logs: 1163106580

listing images URL
3707451071 "https://i.etsystatic.com/22076819/r/il/724fde/3707451071/il_75x75.3707451071_8c3i.jpg"
3709094801 "https://i.etsystatic.com/22076819/r/il/1c73c2/3709094801/il_75x75.3709094801_s0xy.jpg"
3659832288 "https://i.etsystatic.com/22076819/r/il/93de17/3659832288/il_75x75.3659832288_jcto.jpg"
3837624856 "https://i.etsystatic.com/22076819/r/il/93de17/3659832288/il_75x75.3659832288_jcto.jpg"
3659831936 "https://i.etsystatic.com/22076819/r/il/b25aac/3659831936/il_75x75.3659831936_io20.jpg"

3659832288 and 3837624856 have the same URL in the post response (but the correct in GET)

yovasx2 avatar Apr 27 '22 21:04 yovasx2

@yovasx2 Does there seem to be any correlation to whether this happens with there is a new image being uploaded versus an image_id being provided to the endpoint to replace an existing image? Or does it not matter?

etsyachristensen avatar Apr 27 '22 22:04 etsyachristensen

it's always uploading a new file no lisitng_image_id provided, only the file (data) so it generates a new listing_image_id

yovasx2 avatar Apr 28 '22 17:04 yovasx2

@yovasx2 I'm having some trouble duplicating this issue. Do you have a test listing (not an actual client listing) where you are able to duplicate this and that I can make attempts to duplicate with (without messing up your client data)?

etsyachristensen avatar May 05 '22 22:05 etsyachristensen

it's randomly happened when we bulk over ~25 listings we process them sequentially and one of them is most of the time getting the error, what do u need specifically, I think I can send u a video but the affected listing is getting the correct URL after the post via get, the problem is the post response which is spontaneous, we always create draft of the active listings u can create a group of drafts and then remove them

yovasx2 avatar May 06 '22 03:05 yovasx2

Ok thanks for that info. When you say "one of them" I assume you mean just one out of ~25, not a SPECIFIC listing that it happens with every time right? I think this is coming down to some cache issue. I will certainly keep looking into this. If you can do a video that would be great, though I'm not entirely sure it will give me specific context. I'll have to see if there's a way I can generate a script to bulk create listings and upload images to those draft listings.

etsyachristensen avatar May 06 '22 14:05 etsyachristensen

When you say "one of them" I assume you mean just one out of ~25

That's correct

yovasx2 avatar May 09 '22 16:05 yovasx2

@yovasx2 I haven't updated the release notes yet as there is probably more coming today, but i've put out what I am hopeful is a fix for this. As i'm not able to duplicate the issue on my end, I'm hopeful that forcing the cache to refresh will help out. Please test it out and see if it is corrected on your end. If not, can you log the api calls you make (input and response - just using the same example listings you showed me) for the whole process, that would be very helpful.

etsyachristensen avatar May 10 '22 18:05 etsyachristensen

it's still happening and now it seems to be stuck while editing photos (like 250 at the same time)

yovasx2 avatar May 12 '22 18:05 yovasx2

What do you mean by editing photos? are you just referring to the same process above? (replacing photos)?

etsyachristensen avatar May 12 '22 19:05 etsyachristensen

yes, I think the secret to reproduce this is doing what we do, we take a listing, remove all the photos and add them again using image_lisitng_id except for one (the replacement, which is sent as a file, this post response is the one containing the incorrect url), then we hit updateLisitng endpoint with the photo id array to fix any order issue. You need to do this repeatedly to catch it

I shared detailed info via email

yovasx2 avatar May 12 '22 19:05 yovasx2

Got another repro today.

Etsy_listing_image_id | full size URL 4215316227 | https://i.etsystatic.com/18728563/r/il/b9d3c3/4215316227/il_fullxfull.4215316227_cvk0.jpg 4167656654 | https://i.etsystatic.com/18728563/r/il/1680bd/4167656654/il_fullxfull.4167656654_3gw1.jpg 4215316915 | https://i.etsystatic.com/18728563/r/il/e102a6/4215316915/il_fullxfull.4215316915_2wj4.jpg 4167532906 | https://i.etsystatic.com/18728563/r/il/d58221/4167532906/il_fullxfull.4167532906_kfng.jpg 4215317337 | https://i.etsystatic.com/18728563/r/il/8e2cf9/4215317337/il_fullxfull.4215317337_abad.jpg

All those got replaced by https://i.etsystatic.com/18728563/r/il/66f1f7/4167532806/il_75x75.4167532806_p8ee.jpg

diegodleon avatar Sep 15 '22 20:09 diegodleon