0

Magento 2 Categorty page blank with following error

Fatal error: Uncaught Error: Cannot instantiate interface Magento\InventorySalesApi\Api\StockResolverInterface in /var/www/vhosts/blueridge.co.uk/htdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 Stack trace: #0 /var/www/vhosts/blueridge.co.uk/htdocs/vendor/magento/framework/ObjectManager/ObjectManager.php(70): Magento\Framework\ObjectManager\Factory\Dynamic\Developer->create('Magento\\Invento...')
#1 /var/www/vhosts/blueridge.co.uk/htdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(167): Magento\Framework\ObjectManager\ObjectManager->get('Magento\\Invento...')
#2 /var/www/vhosts/blueridge.co.uk/htdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(273): Magento\Framework\ObjectManager\Factory\AbstractFactory->resolveArgument(Array, 'Magento\\Invento...', NULL, 'stockResolver', 'Amasty\\Shopby\\P...')
#3 /var/www/vhosts/blueridge.co.uk/htdocs/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php(236): Magento\Framework\ObjectManager\Facto in /var/www/vhosts/blueridge.co.uk/htdocs/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php on line 50

4 Answers 4

0

Most likely you have a di.xml reference to an implementation of Magento\InventorySalesApi\Api\StockResolverInterface that is inside a module that is disabled.

Search your code base for Magento\InventorySalesApi\Api\StockResolverInterface in di.xml to find exactly which one it is and enable that module.

You could also do bin/magento module:status and enable your modules one by one until it starts to work.

I also see in your error message that the error comes from Amasty\Shopby, so it could be that the Amasty is referencing to a class that either is disabled or do not exist anymore, you could try updating the Amasty module.

2
  • Thankd for the pointer but cant find Magento\InventorySalesApi\Api\StockResolverInterface in the di.xml Nov 15, 2020 at 13:24
  • Is there a way to rebuild the di.xml file from scratch? Nov 15, 2020 at 16:59
0

Found the offending mod as mentioned in the error message uninstalled amasty shopby, compiled site and re-indexed and now working fine

0

I had this issue on one project where all Magento_Inventory* were disabled. When we upgraded the core, new Magento_Inventory* modules got enabled by default which caused the error.

By doing a quick search on etc/config.php, I quickly found and disabled all those new modules and the error was gone.

0

I'm using https://github.com/yireo/magento2-replace-all to replace some magento modules. The "amasty/shiprestriction" forced me to pick some modules out of the replace list:

    "magento/module-inventory-source-selection-api": "*",
    "magento/module-inventory-api": "*",
    "magento/module-inventory-configuration-api": "*",
    "magento/module-inventory-sales-api": "*",

After installing "amasty/xsearch" I got this error too, so i removed the following replace:

    "magento/module-inventory-sales": "*",

After that, the indexing process works again. The reason is, that now the following preference is available:

    <preference for="Magento\InventorySalesApi\Api\StockResolverInterface" type="Magento\InventorySales\Model\StockResolver"/>

The codeblock from "amasty/xsearch", which referenced the api-module:

<virtualType name="searchStockResolver" type="Amasty\Xsearch\Model\Di\Wrapper">
    <arguments>
        <argument name="name" xsi:type="string">Magento\InventorySalesApi\Api\StockResolverInterface</argument>
    </arguments>
</virtualType>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.