cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.3.1 - “Could not receive Stock Item data”

Magento 2.3.1 - “Could not receive Stock Item data”

Hi,

 

I was about to go live with my Magento website when an unexpected error message got displayed in the backend and on the frontend.

 

The error message is “Could not receive Stock Item data”

 

It is displayed in the backend in Catalog -> Products. On that page, no product show up and the error message is displayed. If I disable the "Manage stock" global option in the Inventory configuration menu, then I can see the products.

On the frontend, I get the same message displayed if I try to "add to cart" an item. Today, I am unable to place any order on any of my products. Even disabling the "manage stock" global option does not change the issue on the frontend. The error message still gets displayed.

 

I have tried to restore my Magento installation to a date when I know I could place orders. And guess what, this does not work. The error message keeps being displayed in both backend/frontend. Even deactivating all my third party modules did not solve the issue.

 

I have identified the error message seems to come from the following page:

https://www.magentoextensions.org/documentation/module-inventory-indexer_2_model_2_resource_model_2_...

But I have no idea of the exception it is throwing. What is the cause for this exception. Could it be that my SQL database is corrupted.

 

I am fine losing all my stock information if I can get back my system to work.

Is there a way to reset my Default source and Default stock to heir installation state? Can I truncate all my Inventory tables to start from scratch?

 

I really need your help as I have not found any information on internet related to this issue that seems very new with Magento 2.3.1 and related to MSI.

 

This is really urgent as my website was supposed to go live 4 days ago...

I had already 1 Magento expert and hosting experts looking into the issue, and they are helpless.

 

Thank you in advance to the whole community for your help.

 

BR

Anne

 

4 REPLIES 4

Re: Magento 2.3.1 - “Could not receive Stock Item data”

@ede1200 can you please let me know have you done migration from magento 1 ?

 

Thanks

Re: Magento 2.3.1 - “Could not receive Stock Item data”

Hi Rahul,

Thank you for your reply

Absolutely. I am migrating from Magento 1.9.2.2

 

On the day the issue started I imported a CSV in Magento 2.3.1 through Magento product import function. 

I had an error message and my system started showing the error message "Could not receive Stock Item data” on both frontend and backend as described previously. This was a month ago. On that day I decided to restore to an earlier version and the issue was solved. It started again 3 days ago. My issue is that restoring a backup from last week, at a time when I could place order and my system did not show the message, does not solve the issue this time. It seems my database is deeply corrupted. But, normally, the restoration process restores the database too.

 

I am really lost on what I should do.

 

I really appreciate your help.

 

Regards,

Anne

 

Re: Magento 2.3.1 - “Could not receive Stock Item data”

Updating magento to 2.3.4 version solved this problem for me.

I don't know which was the problem.

Re: Magento 2.3.1 - “Could not receive Stock Item data”

I surprised myself, but I found the solution that worked!

For me, this error was caused by copying the database to a different server so it had a different database name and user.

I could see this error in var/log/exceptions.log

[2022-03-18 11:00:30] main.CRITICAL: Could not receive Stock Item data {"exception":"[object] (Magento\\Framework\\Exception\\LocalizedException(code: 0): Could not receive Stock Item data at /var/www/public/vendor/magento/module-inventory-indexer/Model/ResourceModel/GetStockItemData.php:68, Zend_Db_Statement_Exception(code: 0): SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('affbaaff'@'localhost') does not exist, query was: SELECT `inventory_stock_1`.`quantity`, `inventory_stock_1`.`is_salable` FROM `inventory_stock_1` WHERE (sku = 'IN564N') at /var/www/public/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:235, PDOException(code: HY000): SQLSTATE[HY000]: General error: 1449 The user specified as a definer ('affbaaff'@'localhost') does not exist at /var/www/public/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228)"} []

For me the easy solution was to create the old mysql user on the new server and grant all privileges.

For me the user I need to create is: 'affbaaff'@'localhost'. so change this to whatever is shown in your error.

 

Steps:

- log into your new server by SSH

 - ener mysql

CREATE USER 'affbaaff'@'localhost';
grant all privileges on scotchbox.* to 'affbaaff'@'localhost';

Now try to access the products in your admin again and they should be there.