trustpilot / plugin-magento2

Magento 2 plugin for sending invitation data to Trustpilot
MIT License
10 stars 27 forks source link

Uncaught TypeError: Argument 1 passed to Magento\\InventoryConfiguration\\Model\\IsSourceItemManagementAllowedForProductType\\Interceptor::execute() must be of the type string, null given #83

Closed olegosh closed 3 years ago

olegosh commented 3 years ago

When we try to delete a product by its sku, in version of magento 2.3.6 this error occurs:

Error: Error in making request to https://hostname.com/magento_2_3_6/rest/V1/products Status code: 500 Body: "<br />\n<b>Fatal error</b>: Uncaught TypeError: Argument 1 passed to Magento\\InventoryConfiguration\\Model\\IsSourceItemManagementAllowedForProductType\\Interceptor::execute() must be of the type string, null given, called in /home/username/public_html/magento_2_3_6/vendor/magento/module-inventory-low-quantity-notification/Plugin/Catalog/Model/ResourceModel/Product/ProcessDefaultSourceItemConfigurationPlugin.php on line 83 and defined in /home/username/public_html/magento_2_3_6/generated/code/Magento/InventoryConfiguration/Model/IsSourceItemManagementAllowedForProductType/Interceptor.php:20\nStack trace:\n#0 /home/username/public_html/magento_2_3_6/vendor/magento/module-inventory-low-quantity-notification/Plugin/Catalog/Model/ResourceModel/Product/ProcessDefaultSourceItemConfigurationPlugin.php(83): Magento\\InventoryConfiguration\\Model\\IsSourceItemManagementAllowedForProductType\\Interceptor-&gt;execute(NULL)\n#1 /home/username/public_html/magento_2_3_6/vendor/magento/framework/Interception/Interceptor.php(146): Magento\\InventoryLowQuantityNotifi in <b>/home/username/public_html/magento_2_3_6/generated/code/Magento/InventoryConfiguration/Model/IsSourceItemManagementAllowedForProductType/Interceptor.php</b> on line <b>20</b><br />\n{\"messages\":{\"error\":[{\"code\":500,\"message\":\"Fatal Error: 'Uncaught TypeError: Argument 1 passed to Magento\\\\InventoryConfiguration\\\\Model\\\\IsSourceItemManagementAllowedForProductType\\\\Interceptor::execute() must be of the type string, null given, called in \\/home\\/username\\/public_html\\/magento_2_3_6\\/vendor\\/magento\\/module-inventory-low-quantity-notification\\/Plugin\\/Catalog\\/Model\\/ResourceModel\\/Product\\/ProcessDefaultSourceItemConfigurationPlugin.php on line 83 and defined in \\/home\\/username\\/public_html\\/magento_2_3_6\\/generated\\/code\\/Magento\\/InventoryConfiguration\\/Model\\/IsSourceItemManagementAllowedForProductType\\/Interceptor.php:20\\nStack trace:\\n#0 \\/home\\/username\\/public_html\\/magento_2_3_6\\/vendor\\/magento\\/module-inventory-low-quantity-notification\\/Plugin\\/Catalog\\/Model\\/ResourceModel\\/Product\\/ProcessDefaultSourceItemConfigurationPlugin.php(83): Magento\\\\InventoryConfiguration\\\\Model\\\\IsSourceItemManagementAllowedForProductType\\\\Interceptor->execute(NULL)\\n#1 \\/home\\/username\\/public_html\\/magento_2_3_6\\/vendor\\/magento\\/framework\\/Interception\\/Interceptor.php(146): Magento\\\\InventoryLowQuantityNotifi' in '\\/home\\/username\\/public_html\\/magento_2_3_6\\/generated\\/code\\/Magento\\/InventoryConfiguration\\/Model\\/IsSourceItemManagementAllowedForProductType\\/Interceptor.php' on line 20\",\"trace\":\"Trace is not available.\"}]}}"

It seems that problem might be in DB table with sku with values equal to null, the solution might be like this:

UPDATE catalog_product_entity SET sku='' WHERE sku IS NULL;

But I don't have a catalog_product_entity table and these products are generated and deleted on the fly by tests in order to make sure that process of deletion products by their sku works fine. It works in version 2.3.5, but in version 2.3.6 doesn't work. What could be a possible solution to this issue?