1

I copied a Magento 2.4.6 to the live server and suddenly I am getting this error when the search index is being reindexed:

Cannot instantiate interface Magento\InventoryIndexer\Model\StockIndexTableNameResolverInterface

Its running on PHP 8.1 and the elasticsearch setup was tested successfully. What would be the reason for that?

Thanks!

1
  • Please check if table "inventory_stock_1" exist on the live server. Commented Jun 29, 2023 at 13:49

3 Answers 3

0

Flush the Redis cache if you're using Redis. After upgrading to the new Magento version, did you restart Varnish? If not, restart it.

If the issue persists, check if the file for Magento\InventoryIndexer\Model\StockIndexTableNameResolverInterface interface, which is located in vendor/magento/module-inventory-indexer/Model/StockIndexTableNameResolverInterface.php is existed or not. If not, you should make another deployment.

You mentioned "copied a Magento 2.4.6 to the live server", looks like you copy all the files manually, isn't it? If so, you should use a deployment tool such as Capistrano or PHP Deployer to deploy automatically without downtime.

If you still want to do your change manually, and the file mentioned above does not exist, you can enable the maintenance mode and reinstall the Magento packages and recompile code. To achieve that, take the following steps:

  1. Enable the maintenance mode:
 bin/magento maintenance:enable
  1. Backup the composer.lock file and the vendor directory. After that, remove the vendor directory (alternatively, you can rename it to backup it: mv vendor vendor_backup):
cp composer.lock composer.lock.bak && cp -r vendor vendor_backup && rm -rf vendor
  1. Reinstall composer packages:
composer install
  1. Remove generated and cache directories and flush cache:
rm -rf generated/*/* var/cache/ var/page_cache/ && bin/magento cache:flush
  1. Recompile code:
bin/magento setup:di:compile
  1. Disable the maintenance mode:
bin/magento maintenance:disable
  1. Do reindex:
bin/magento indexer:reindex
0

for me after disabled 'Magento_InventoryElasticsearch' is working. i am not using multi-source inventory(MSI)

bin/magento module:disable Magento_InventoryElasticsearch
0

I ran into this error as well. My installation had removed this module via composer.json by adding "magento/module-inventory-indexer": "*", to the replace section.

I removed this entry from composer.json and then ran composer require magento/module-inventory-indexer followed by the standard recompile commands.

Your Answer

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

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