cancel
Showing results for 
Search instead for 
Did you mean: 

How to debug Magento 2 REST API error - catalogInventoryStockRegistry

SOLVED

How to debug Magento 2 REST API error - catalogInventoryStockRegistry

I am trying to integrate Magento with our own inventory management. When using the catalogInventoryStockRegistry POST API: http://magento-dev/rest/V1/products/T760/stockItems/2

I got an internal error: "message":"Class Magento\TargetRule\Model\Catalog\Product\Attribute\Backend\Rule does not exist", "trace":"#0 /var/www/html/magento2/vendor/magento/module-catalog-inventory/Model/StockRegistry.php(194): Magento\CatalogInventory\Model\Stock\StockItemRepository->save(Object(Magento\CatalogInventory\Model\Stock\Item))\n#1 [internal function]: Magento\CatalogInventory\Model\StockRegistry->updateStockItemBySku('T760', Object(Magento\CatalogInventory\Model\Stock\Item))\n#2 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(265): call_user_func_array(Array, Array)\n#3 /var/www/html/magento2/vendor/magento/module-webapi/Controller/Rest.php(160): Magento\Webapi\Controller\Rest->processApiRequest()\n#4 /var/www/html/magento2/var/generation/Magento/Webapi/Controller/Rest/Interceptor.php(24): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))\n#5 /var/www/html/magento2/vendor/magento/framework/App/Http.php(115): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))\n#6 /var/www/html/magento2/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch()\n#7 /var/www/html/magento2/pub/index.php(37): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http))\n#8 {main}"

All my ids should be valid - I used the output data from GET, just update the qty. Any suggestions on how to find out which rule failed?

4 REPLIES

Re: How to debug Magento 2 REST API error - catalogInventoryStockRegistry

There is no Magento_TargetRule module in Magento 2 Community Edition. Where is this module from? Do you use Magento Enterprise?

Re: How to debug Magento 2 REST API error - catalogInventoryStockRegistry

We have the install Enterprise version, but you are correct that I could not file the module in github --hence I was looking for ideas to debug. Any suggestions are welcome.

Re: How to debug Magento 2 REST API error - catalogInventoryStockRegistry

As I understand, Enterprise customers can get support directly from the Magento 2 Team.

 

Ensure your success with Magento Enterprise Edition with dedicated account management, 24/7 technical support, and a team relentlessly focused on security. Plus, you’ll have access to expert consulting for problem-solving and technical advice.

 

https://magento.com/products/enterprise-edition

Re: How to debug Magento 2 REST API error - catalogInventoryStockRegistry

I'm closing this issue -- as it magically worked after re-install. Though I still want to note that the response body was not json.