Error "could not successfully be saved" API response

Trevor_Barton
Shopify Partner
1 0 1

Store: https://trevdevplayground.myshopify.com/

Hey Guys. 

I have built an application that slowly trickles in data from a remote API and then creates a new product. It does so in steps!

  1. Checks a store if the product exists based on a 'unique' vendor tag using a unique ID from the remote API.
  2. If it exists, it updates the product pricing
  3. If it doesn't, it creates a new product.

Things are going smashingly until around the 25k product mark. We start getting intermittent "base: could not successfully be saved". Luckly we've logged the delivery data for each and every product and can provide examples of failed POST JSON strings:

{"product":{"variants":[{"option1":"Normal","price":"292.37"},{"option1":"Foil","price":"438.56"}],"images":[{"src":"https://img.scryfall.com/cards/en/lea/275.jpg?20170330011327"}],"title":"Winter Orb","vendor":"9359f60c-9a27-4e53-b35b-964a121a6fba","body_html":"As long as Winter Orb is untapped, players can't untap more than one land during their untap steps.","tags":"Type_Singles, Limited Edition Alpha, set_Limited Edition Alpha, rare, rarity_rare, Artifact, Card Type_Artifact"}}

{"product":{"variants":[{"option1":"Normal","price":"7.68"},{"option1":"Foil","price":"11.52"}],"images":[{"src":"https://img.scryfall.com/cards/en/lea/270.jpg?20170330011327"}],"title":"Soul Net","vendor":"2b814198-814b-4619-a158-327af675f8f2","body_html":"Whenever a creature dies, you may pay {1}. If you do, you gain 1 life.","tags":"Type_Singles, Limited Edition Alpha, set_Limited Edition Alpha, uncommon, rarity_uncommon, Artifact, Card Type_Artifact"}}

I am delivering these JSON strings to the API using a private API URI and PHP cURL.

<?php
function curl($query) {

	$curl = curl_init();

	$curlOptions = array(

		CURLOPT_URL => $query->url, // Private API URL
		CURLOPT_CUSTOMREQUEST => $query->method, // POST
		CURLOPT_POSTFIELDS => $query->payload, // JSON String
		CURLOPT_CONNECTTIMEOUT => 30,
		CURLOPT_HEADER => false,
		CURLOPT_HTTPHEADER => array("Content-Type: application/json"),
		CURLOPT_RETURNTRANSFER => 1
	);

	curl_setopt_array($curl, $curlOptions);
	
	$response = curl_exec($curl);

	if ($response === false) $response = curl_error(stripcslashes($curl));

	curl_close($curl);

	return $response;


}
?>

Any ideas as to why I'm seemingly getting this error thrown randomly? 

Replies 5 (5)
Busfox
Shopify Staff
619 49 99

Hi there,

Looking in our logs, I definitely see an influx of similar errors. I'm investigating this now and will report back. Thanks for reporting this issue to us!

Andrew | 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 the Shopify Help Center or the Shopify Blog

channelape
New Member
2 0 0

Hi @Busfox,

We've been seeing this same issue in our logs dating back a few weeks with most recent being 04/26/17.

{ "errors": { "base": [ "could not successfully be saved" ] } }

It seems we haven't seen after 04/26/17 so I'm thinking maybe this has been resolved?

 

channelape
New Member
2 0 0

Hi Busfox,

We saw this same error in our logs dating back a few weeks with most recent being 04/26.

Was this remedied? 

R_J__Davis
New Member
2 0 0

Hello Andrew,

Has there been any update on this issue? I have seen the same error mentioned above several times while creating products on Shopify over the past few weeks. My company's app is not retrying these requests because they come back with a 422 status code leading us to believe it is something wrong with our data but in this case it does not seem to be. The Shopify product ends up still being created even with the 422 response code and that causes our system to be out of sync with Shopify (because it assumes the product was not created since there was no 201 response).

Any insight into this issue would be appreciated as it is causing problems for several of my company's customers. Thanks!

Shawn_Tolidano
New Member
1 0 0

This is happening to me as well.

I have under 2,000 products, so I see no volume-based reason.

This happens when I update a product with a completely new set of options (and I do not remove variants first, but send a new set of variants with the new set of options).

My next step is to just delete everything and start over, but obviously I'd prefer not to.

 

================JSON=============
{"product":{"title":"1602 Witch Hunter Magazine Subscription","body_html":"<b>You save 37% off the cover!<\/b><br\/><b>1 Year Subscription of 12 issues for $29.99<br\/>Only $2.50 per issue!<\/b><br\/><p><img src=\"\/\/cdn.shopify.com\/s\/files\/1\/1868\/4705\/files\/Trustmarks_48e31d07-2295-468e-abfa-c9e8a8e34327_large.png?v=1510887776\" alt=\"Trust MagazineAmerica for your Magazine Subscription\" \/><\/p><p>Purchase  your 1602 Witch Hunter magazine subscription from  MagazineAmerica.com with confidence. We offer a 90-day satisfaction guarantee! If  you are not satisfied with your purchase for any reason, notify customer service  and we will promptly issue a 100% full refund. With over 10 years of experience  in the magazine industry, we know how to provide great service and support.<\/p>","vendor":"Magazine America","product_type":"Magazine Subscription","options":[{"name":"Subscription","values":["New Subscription","Renewal Subscription","Gift Subscription"]}],"variants":[{"sku":"MA6-12-N","price":"29.99","option1":"New Subscription","compare_at_price":47.88},{"sku":"MA6-12-R","price":"29.99","option1":"Renewal Subscription","compare_at_price":47.88},{"sku":"MA6-12-G","price":"29.99","option1":"Gift Subscription","compare_at_price":47.88}]}}
================JSON=============

==========EXCEPTION ON PUT OF ABOVE PRODUCT===========
Client error: `PUT https://my-magazine-subscription.myshopify.com/admin/products/592588832800.json` resulted in a `422 Unprocessable Entity` response:
{"errors":{"base":["could not successfully be saved"]}}