Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Occasionally I've had issues where an image doesn't download properly from shopify. When this happens there are no protections to gracefully deal with the fail and the sync stops.
Product syncing when there is an image fails every time for me.
It appears to be failing at entity creation. Attached screenshot of error.
But, root cause seems to be line 314 in shopify.entity.inc. system_retrieve_file fails and returns FALSE, so passing that onto entity api is also failing.
Edit: Okay, it appears to only fail when retrieving images from https protocol.
I seem to have found what caused the problem.
I had set the Shopify Product Images field settings to only allow 1 value, changing it to unlimited values fixed the problem.
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=9&op=do StatusText: Service unavailable (with message) ResponseText: EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set() (line 122 of /Volumes/Other_Stuff/htdocs/php/shopify.my/sites/all/modules/entity/includes/entity.wrapper.inc).
Comments
Comment #1
John Carbone CreditAttribution: John Carbone commentedPlease provide steps to reproduce.
Comment #2
jh sio CreditAttribution: jh sio commentedDrupal version 7.39
Module version 7.x-1.0-alpha7
Product syncing when there is an image fails every time for me.
It appears to be failing at entity creation. Attached screenshot of error.
But, root cause seems to be line 314 in shopify.entity.inc. system_retrieve_file fails and returns FALSE, so passing that onto entity api is also failing.
Edit: Okay, it appears to only fail when retrieving images from https protocol.
Comment #3
jh sio CreditAttribution: jh sio commentedComment #4
jh sio CreditAttribution: jh sio commentedI solved my problem by using curl instead.
Changed shopify.entity.inc, line 314 from
$file = system_retrieve_file($product_image['src'], $directory, TRUE, FILE_EXISTS_REPLACE);
to
Comment #5
jh sio CreditAttribution: jh sio commentedComment #6
mathiasha CreditAttribution: mathiasha commentedI get same the exact same error when trying to sync.
Changing shopify.entity.inc as jh sio suggested didn't make any difference.
The error started occurring after changed the variants some products on Shopify, but I don't know if that is what caused the problem.
Comment #7
mathiasha CreditAttribution: mathiasha commentedI seem to have found what caused the problem.
I had set the Shopify Product Images field settings to only allow 1 value, changing it to unlimited values fixed the problem.
Comment #8
tseven CreditAttribution: tseven as a volunteer commentedI've experienced the same issue.
An AJAX HTTP error occurred. HTTP Result Code: 500 Debugging information follows. Path: /batch?id=9&op=do StatusText: Service unavailable (with message) ResponseText: EntityMetadataWrapperException: Invalid data value given. Be sure it matches the required data type and format. in EntityMetadataWrapper->set() (line 122 of /Volumes/Other_Stuff/htdocs/php/shopify.my/sites/all/modules/entity/includes/entity.wrapper.inc).
I was unable to complete a sync until I applied jh sio's curl work-a-around.
Here is a modified version which uses curl if available and falls back to the old way otherwise:
Comment #10
donutdan4114 CreditAttribution: donutdan4114 at Bonify commentedComment #12
tseven CreditAttribution: tseven as a volunteer commentedThe fix in #4 again referenced #8 does fix the download error but it leaves the files with temporary file names.
The modified code below fixes that issue: