Hey there,
This sounds strange, I haven't been able to replicate on my own test store.
Do you happen to have an example request ID where this happened, or even the ID of the article that you were updating and a rough timeframe in which the update would have occurred? I could check our logs here to see if anything looks out of place.
I used this line target = shopify.Article.find(target_id, blog_id = blog_id) to find out the blog article. I tried to update title and description with
target.title = title
target.body_html = description
However, after I called target.save(), the feature image was removed. the image attribute of the article was gone.
Hey again,
It looks like that article has had several updates performed on it, and I've been trying to copy them but still haven't been able to get the image to remove itself while making calls with an HTTP client.
Is there any chance you track request IDs and know of a specific request that caused the image to be deleted, or should I assuming that all of these updates caused the image issue to occur?
Yes, I've added some codes to check which part caused the crash.
shopify.ShopifyResource.activate_session(session)
result = checkAjaxPOST(request)
if result != 1:
return result
type_value = request.POST.get('type')
target_id = request.POST.get('id')
target = ''
if type_value == 'product':
target = shopify.Product.find(target_id)
elif type_value == 'article':
blog_id = request.POST.get('blog_id')
target = shopify.Article.find(target_id, blog_id = blog_id)
# logger.info("article = " + target.title + " handle = " + target.handle)
print "article = " + target.title + "; handle = " + target.handle
if hasattr(target, 'image'):
print "; image 0 = " + target.image.src
else:
print "image 0 = none"
# target.image = target.image # image is lost after setting the focus keyword. This line is to fix this bug
else:
return JsonResponse({ 'error': 'not valid type_value.' })
title = request.POST.get('title')
keywords = request.POST.get('keywords')
description = request.POST.get('description')
target.title = title
target.body_html = description
target.save()
target = shopify.Article.find(target_id, blog_id = blog_id)
if hasattr(target, 'image'):
print "; image 1 = " + target.image.src
else:
print "image 1 = none"
loop_var = { 0 : {'key': 'keywords_tag', 'value': keywords} }
for index in loop_var:
updateMetafield(index, loop_var, target_id, type_value)
target = shopify.Article.find(target_id, blog_id = blog_id)
if hasattr(target, 'image'):
print "; image 2 = " + target.image.src
else:
print "image 2 = none"
data = {"title": title, "keywords": keywords, "description": description}
return JsonResponse(data)
After testing, I got
article = WAS HAT TAPKEY MIT COWORKING ZU TUN?; handle = was-hat-tapkey-mit-coworking-zu-tun
[Thu Oct 25 17:04:59.128389 2018] [:error] [pid 23977] ; image 0 = https://cdn.shopify.com/s/files/1/1498/3202/articles/23102018_Challenges_Coworking_900x_18bbcf15-1be...
[Thu Oct 25 17:05:01.776095 2018] [:error] [pid 23977] image 1 = none
[Thu Oct 25 17:05:05.006657 2018] [:error] [pid 23977] image 2 = none
When I tried to move target.save() at the end before return, I got:
article = WAS HAT TAPKEY MIT COWORKING ZU TUN?; handle = was-hat-tapkey-mit-coworking-zu-tun
[Thu Oct 25 17:17:45.951124 2018] [:error] [pid 24141] ; image 0 = https://cdn.shopify.com/s/files/1/1498/3202/articles/pexels-photo-884977.jpeg?v=1540459039
[Thu Oct 25 17:17:47.014086 2018] [:error] [pid 24141] ; image 1 = https://cdn.shopify.com/s/files/1/1498/3202/articles/pexels-photo-884977.jpeg?v=1540459039
[Thu Oct 25 17:17:50.308937 2018] [:error] [pid 24141] ; image 2 = https://cdn.shopify.com/s/files/1/1498/3202/articles/pexels-photo-884977.jpeg?v=1540459039
So I don't know why it's going wrong.
Hello again,
I'm still working on attempting to replicate this but have not been able to. When checking our logs as well, any logs of attempts by your app to update the blog article have now expired so I wouldn't be able to copy them.
Would you be able to update the article with another featured image, and then perform the same update that caused the image to be removed? It would be ideal if you could only perform a single update as well to make it easier to track down where the issue may lie - or provide the value of the X-Request-Id header from the response you receive after performing the update.
Hi,
I tried to duplicate the issue with 4 - 5 requests for this article: https://sillycube-test.myshopify.com/blogs/news/was-hat-tapkey-mit-coworking-zu-tun. The last request can duplicate the issue.
When I tried to update the keywords metafield from "coworking" to "coworking1", the featured image was cleared. I was testing the issue in spo_development app: https://partners.shopify.com/491836/apps/1501395#/
User | Count |
---|---|
25 | |
8 | |
7 | |
6 | |
4 |