trustpilot / plugin-magento2

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

Exception: The store that was requested wasn't found. Verify the store and try again. #38

Closed Dnd-Mafer closed 5 years ago

Dnd-Mafer commented 5 years ago

On Magento 2.3.1.

Steps to reproduce :

Result : 1 exception(s): Exception #0 (Magento\Framework\Exception\NoSuchEntityException): The store that was requested wasn't found. Verify the store and try again.

Expected : The page is rendered correctly

Looking at the PHP code, the problem is really simple : there is a function which get website OR store id param (huge mistake), then tru to set this id to a store an load it. Store with id 1 doesn't exist so it throws NoSuchEntityException ...

vilgro commented 5 years ago

Thank you. The issue has been fixed

peterjaap commented 5 years ago

We had this issue too, it was fixed by this commit; https://github.com/trustpilot/plugin-magento2/commit/0b61e8a070c351e08efaa1443fdda45e7001ec37#diff-ba831d6ebf676d30078ddf36a6af78a9

Although this indeed fixes it, it is still a terrible practice to mis-use the core_config_data table for logging, which is happening here. The base64 encoded message in our core_config_data table was Automatic invitation sending failed, which is saved here; https://github.com/trustpilot/plugin-magento2/blob/53bd5b648ef97a2f7632da745262c4ebbca93f63/Observer/OrderSaveObserver.php#L89

This should be moved to its own seperate logging table and be read from there, instead misusing a core table that's intended for configuration settings.