magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

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

Open jdereus87 opened this issue 4 years ago • 20 comments

Preconditions (*)

  1. Magento 2.4.3

Steps to reproduce (*)

  1. Change website name + storename to something that has a number. Example: '2 Unlimited'
  2. Refund an order
  3. Tab: Credit Memos now gives an error The store that was requested wasn't found. Verify the store and try again. Exception in /data/web/magento2/vendor/magento/module-store/Model/StoreRepository.php:75
  4. Menu -> Sales -> Credit Memos gives an identical error

Expected result (*)

  1. Credit memo grid Shows

Actual result (*)

  1. Credit Memo Grid gives an error.

Workaround: Remove the numbers from the store name and website name

Tested it on an existing 2.4.3 installation + a fresh 2.4.3. installation. I have processed this through xdebug.

  1. It recursively loops trough components starting in: vendor/magento/framework/View/Element/UiComponent/Context.php:255, changing values by pass by reference.
  2. Eventually it will get to the store_id component. It will run the store ID parameter through the following function: vendor/magento/module-store/Ui/Component/Listing/Column/Store.php:93 -> PrepareItem().
  3. Since the functions are all passed by reference, the data changes. The store_id value changes from a simple integer to the following: "2unlimited.nl
       2unlimited
          unlimited
    " Note: the string contains nbsp and br tags
  4. Eventually it loops to the 'subtotal' component: vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php The store_id value that was changed is being used there. Function: prepareDataSource();

$storeId = isset($item['store_id']) && (int)$item['store_id'] !== 0 ? $item['store_id'] : $this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID); $store = $this->storeManager->getStore( $storeId ); Normally it gives a true & false value on the check, which causes the store_id to be set back to 0. However because there is a number in the storename (see string above), the (int) cast sets the int to 2. It now gives a true & true, and the store_id stays the strange string. 5. In the storerepository it eventually gets to the get() function, where it fails and gives the error. vendor/magento/module-store/Model/StoreRepository.php: line 63, error on line 75.

Additional Info (*)

Note:

  1. There is no issue when Website name is given as "Unlimitted 2" (Issue raises)
  2. In 2.4-develop we can't even refund! If we try to navigate to the Credit Memo, we get the error in page loading itself. image

Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.

  • [ X] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.

jdereus87 avatar Oct 15 '21 06:10 jdereus87

Hi @jdereus87. Thank you for your report. To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.

:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

m2-assistant[bot] avatar Oct 15 '21 06:10 m2-assistant[bot]

@magento give me 2.4-develop instance

jdereus87 avatar Oct 15 '21 10:10 jdereus87

Hi @jdereus87. Thank you for your request. I'm working on Magento instance for you.

Hi @jdereus87, here is your Magento Instance: https://d49b2d3a0f4ea2fcb02ea39e7b5361f9-2-4-develop.instances.magento-community.engineering Admin access: https://d49b2d3a0f4ea2fcb02ea39e7b5361f9-2-4-develop.instances.magento-community.engineering/admin_db9d Login: eac3ff48 Password: c1c1b0d64620

Bug reproduced in dev instance.

Placing a 2 on both the store name + store website directly breaks the sales -> credit memos grid with error: The store that was requested wasn't found. Verify the store and try again.

jdereus87 avatar Oct 15 '21 11:10 jdereus87

This happens also when a website/store is deleted, but creditmemos created for it are not deleted. Can be reproducted in M2.4.3+. This is the problematic commit that changed the behaviour of price formatting: https://github.com/magento/magento2/commit/bd329b681eeab9b667f2fcbe4a1aa67d23d4b3e3#diff-b21bcef0c4a13409058d73a22b1458373bf986d2ccce532d5382c96d2fb04ccb

pemann avatar Oct 15 '21 13:10 pemann

website/stores ids imho should be restrict and avoid delete. But i think core code not able handle that. Instead should expose more helpful error exception in the case we go wrong

The store that was requested wasn't found. Verify the store and try again. => Maybe add some id for able to recheck

mrtuvn avatar Oct 16 '21 01:10 mrtuvn

Hi @engcom-November. Thank you for working on this issue. In order to make sure that issue has enough information and ready for development, please read and check the following instruction: :point_down:

  • [ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • [ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • [ ] 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • [ ] 4. Verify that the issue is reproducible on 2.4-develop branch

    Details- Add the comment @magento give me 2.4-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.4-develop branch, please, add the label Reproduced on 2.4.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • [ ] 5. Add label Issue: Confirmed once verification is complete.

  • [ ] 6. Make sure that automatic system confirms that report has been added to the backlog.

m2-assistant[bot] avatar Oct 18 '21 12:10 m2-assistant[bot]

Verified the issue on Magento 2.4-develop branch and the issue is reproducible: Steps performed: Admin - Stores - All Stores - Edit Website - Changed name to "2 Unlimitted" and Save Changed Store name to "2 Unlimitted" and Save View Sales - Credit Memos Issue; "The store that was requested wasn't found. Verify the store and try again." is displayed to the User Note: There is no issue when Website name is given as "Unlimitted 2" image

[2021-10-18T12:52:10.958580+00:00] main.CRITICAL: Magento\Framework\Exception\NoSuchEntityException: The store that was requested wasn't found. Verify the store and try again. in /var/www/html/mg24/magento2/app/code/Magento/Store/Model/StoreRepository.php:75
Stack trace:
#0 /var/www/html/mg24/magento2/app/code/Magento/Store/Model/StoreManager.php(171): Magento\Store\Model\StoreRepository->get()
#1 /var/www/html/mg24/magento2/app/code/Magento/Sales/Ui/Component/Listing/Column/Price.php(84): Magento\Store\Model\StoreManager->getStore()
#2 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php(397): Magento\Sales\Ui\Component\Listing\Column\Price->prepareDataSource()
#3 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php(394): Magento\Framework\View\Element\UiComponent\Context->prepareDataSource()
#4 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php(394): Magento\Framework\View\Element\UiComponent\Context->prepareDataSource()
#5 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Element/UiComponent/Context.php(255): Magento\Framework\View\Element\UiComponent\Context->prepareDataSource()
#6 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout/Generic.php(75): Magento\Framework\View\Element\UiComponent\Context->getDataSourceData()
#7 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout/Generator/Structure.php(46): Magento\Framework\View\Layout\Generic->build()
#8 /var/www/html/mg24/magento2/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php(102): Magento\Framework\View\Layout\Generator\Structure->generate()
#9 /var/www/html/mg24/magento2/app/code/Magento/Ui/TemplateEngine/Xhtml/Result.php(124): Magento\Ui\TemplateEngine\Xhtml\Result->appendLayoutConfiguration()
#10 /var/www/html/mg24/magento2/app/code/Magento/Ui/Component/Wrapper/UiComponent.php(73): Magento\Ui\TemplateEngine\Xhtml\Result->__toString()
#11 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Element/AbstractBlock.php(1114): Magento\Ui\Component\Wrapper\UiComponent->_toHtml()
#12 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Element/AbstractBlock.php(1118): Magento\Framework\View\Element\AbstractBlock->Magento\Framework\View\Element\{closure}()
#13 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Element/AbstractBlock.php(678): Magento\Framework\View\Element\AbstractBlock->_loadCache()
#14 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(591): Magento\Framework\View\Element\AbstractBlock->toHtml()
#15 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(553): Magento\Framework\View\Layout->_renderUiComponent()
#16 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#17 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#18 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#19 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#20 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#21 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#22 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#23 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#24 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#25 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#26 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#27 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#28 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#29 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#30 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#31 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#32 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#33 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#34 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#35 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#36 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#37 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#38 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(606): Magento\Framework\View\Layout->renderElement()
#39 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(557): Magento\Framework\View\Layout->_renderContainer()
#40 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(510): Magento\Framework\View\Layout->renderNonCachedElement()
#41 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Layout.php(975): Magento\Framework\View\Layout->renderElement()
#42 /var/www/html/mg24/magento2/generated/code/Magento/Framework/View/Layout/Interceptor.php(41): Magento\Framework\View\Layout->getOutput()
#43 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Result/Page.php(260): Magento\Framework\View\Layout\Interceptor->getOutput()
#44 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/View/Result/Layout.php(171): Magento\Framework\View\Result\Page->render()
#45 /var/www/html/mg24/magento2/generated/code/Magento/Backend/Model/View/Result/Page/Interceptor.php(23): Magento\Framework\View\Result\Layout->renderResult()
#46 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/App/Http.php(120): Magento\Backend\Model\View\Result\Page\Interceptor->renderResult()
#47 /var/www/html/mg24/magento2/lib/internal/Magento/Framework/App/Bootstrap.php(264): Magento\Framework\App\Http->launch()
#48 /var/www/html/mg24/magento2/pub/index.php(30): Magento\Framework\App\Bootstrap->run()
#49 {main} [] []

engcom-November avatar Oct 18 '21 12:10 engcom-November

:white_check_mark: Jira issue https://jira.corp.magento.com/browse/AC-1508 is successfully created for this GitHub issue.

github-jira-sync-bot avatar Oct 18 '21 12:10 github-jira-sync-bot

:white_check_mark: Confirmed by @engcom-November. Thank you for verifying the issue.
Issue Available: @engcom-November, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.

m2-assistant[bot] avatar Oct 18 '21 12:10 m2-assistant[bot]

Ran into the same problem yesterday. We also have digits in our website name and group name.

The problem originates from Magento/Sales/Ui/Component/Listing/Column/Price.php Line 81.

$storeId = isset($item['store_id']) && (int)$item['store_id'] !== 0 ? $item['store_id'] :
    $this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID);

adding a numeric check fixes the issue.

$storeId = isset($item['store_id']) && is_numeric($item['store_id']) && (int)$item['store_id'] !== 0
    ? $item['store_id']
    : $this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID);

I'm not sure why the data source provides the store name as the store id (probably something to do with displaying data in the grid) but because this store name string is typecasted to an integer, the digits remain and the getStore function tries to load the store with this string instead of the fallback (default store).

commit: https://github.com/magento/magento2/pull/34716/commits/5b1b00d33f6cbb8d036fd3a7b367361e303c355c

j-stam avatar Nov 25 '21 11:11 j-stam

@magento I am working on this

nazarklovanych avatar May 05 '22 10:05 nazarklovanych

this is already fixed in 2.4.4 @jdereus87 we can close.

nazarklovanych avatar May 05 '22 12:05 nazarklovanych

Where can we get the fix for M2.4.3 ? Thanks.

eBusinessAtlantique avatar Jul 06 '22 09:07 eBusinessAtlantique

Hi @jdereus87 and @nazarklovanych , we are on 2.4.4 and still experiencing this problem on the creditmemo page.

seungwooc-23 avatar Sep 20 '22 17:09 seungwooc-23

When a store is deleted the credit memo grid is sending an error and do not displays. Solution : Remove these lines in this file : \vendor\magento\module-store\Model\StoreRepository.php around line 112

    if ($store->getId() === null) {
        throw new NoSuchEntityException(
            __("The store that was requested wasn't found. Verify the store and try again.")
        );
    }

eBusinessAtlantique avatar Sep 04 '23 13:09 eBusinessAtlantique

I can confirm this issue in magento 2.4.6-p3.... i get this error when i sort the credit memo grid for the column "Credit Memo"...

image

error in response in console:

{
    "error": "The store that was requested wasn't found. Verify the store and try again.",
    "errorcode": "0"
}

simonmaass avatar Feb 19 '24 15:02 simonmaass

Still got this issue on 2.4.5-p6

roman204 avatar Jun 26 '24 09:06 roman204

maybe someone can use it...

Index: vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php b/vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php
--- a/vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php
+++ b/vendor/magento/module-sales/Ui/Component/Listing/Column/Price.php	(date 1719395045132)
@@ -8,6 +8,7 @@
 namespace Magento\Sales\Ui\Component\Listing\Column;

 use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Exception\NoSuchEntityException;
 use Magento\Framework\View\Element\UiComponent\ContextInterface;
 use Magento\Framework\View\Element\UiComponentFactory;
 use Magento\Store\Model\Store;
@@ -82,7 +83,11 @@
                     $itemStoreId = $item['store_id'] ?? '';
                     $storeId = $itemStoreId && is_numeric($itemStoreId) ? $itemStoreId :
                         $this->context->getFilterParam('store_id', Store::DEFAULT_STORE_ID);
-                    $store = $this->storeManager->getStore($storeId);
+                    try {
+                        $store = $this->storeManager->getStore($storeId);
+                    } catch (NoSuchEntityException $entityException){
+                        $store = $this->storeManager->getStore(Store::DEFAULT_STORE_ID);
+                    }
                     $currencyCode = $store->getBaseCurrency()->getCurrencyCode();
                 }
                 $basePurchaseCurrency = $this->currency->load($currencyCode);

roman204 avatar Jun 27 '24 15:06 roman204