magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.5k stars 9.3k forks source link

After upgrading to new version - No such entity with customerId critical logs #23411

Closed chequille closed 4 years ago

chequille commented 5 years ago

Summary

Sorry to say this, but as usually, after upgrading Magento versions something is wrong at the end. I did have no exceptions and no errors before. Now upgrading to 2.3.2 I get exceptions like: [2019-06-25 21:46:34] main.CRITICAL: Keine Eintrag mit customerId = 1 {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): Keine Eintrag mit customerId = 1 at /var/www/vhosts/hopfenmuseum-tettnang.de/magento.hopfenexpress.de/vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []

Preconditions

Magento 2.3.2 PHP 7.2

Steps to reproduce

  1. Setup vanilla Magento 2.3.2 using composer (no sample data is needed)
  2. In the backend, create a category and a product
  3. In the frontend, register as a new customer
  4. Put the product in your cart and go to the checkout 5 .Enter your shipping address and use the same address in the payment step
  5. Place an order
  6. Look at the var/log/exception.log file, it contains 4 errors:
    [2019-06-29 14:34:05] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []
    [2019-06-29 14:34:06] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []
    [2019-06-29 14:34:08] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []
    [2019-06-29 14:34:08] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []
  7. Go to the home page or any other page while still being logged in
  8. An additional line is added to the var/log/exception.log file each time you visit a page:
    [2019-06-29 14:36:58] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\\Framework\\Exception\\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []

Expected result

No errors

Actual result

[2019-06-29 14:34:05] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} [] [2019-06-29 14:34:06] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} [] [2019-06-29 14:34:08] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} [] [2019-06-29 14:34:08] main.CRITICAL: No such entity with customerId = 1 {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with customerId = 1 at vendor/magento/framework/Exception/NoSuchEntityException.php:50)"} []

Additional information

From the comment

This last one seems to come from the ajax request to /customer/section/load/?sections=cart&force_new_section_timestamp=false&_=1561818997600

Putting a break point in that NoSuchEntityException.php file on line 50 and then calling that ajax endpoint, gives me the following stack trace:

Magento\Framework\Exception\NoSuchEntityException::singleField (vendor/magento/framework/Exception/NoSuchEntityException.php:50)
Magento\Quote\Model\QuoteRepository\Interceptor->loadQuote (vendor/magento/module-quote/Model/QuoteRepository.php:232)
Magento\Quote\Model\QuoteRepository\Interceptor->getForCustomer (vendor/magento/module-quote/Model/QuoteRepository.php:149)
Magento\Quote\Model\QuoteRepository\Interceptor->___callParent (vendor/magento/framework/Interception/Interceptor.php:58)
Magento\Quote\Model\QuoteRepository\Interceptor->Magento\Framework\Interception\{closure:vendor/magento/framework/Interception/Interceptor.php:104-151} (vendor/magento/framework/Interception/Interceptor.php:138)
Magento\Quote\Model\QuoteRepository\Interceptor->___callPlugins (vendor/magento/framework/Interception/Interceptor.php:153)
Magento\Quote\Model\QuoteRepository\Interceptor->getForCustomer (generated/code/Magento/Quote/Model/QuoteRepository/Interceptor.php:39)
Magento\Quote\Model\QuoteRepository\Interceptor->getActiveForCustomer (vendor/magento/module-quote/Model/QuoteRepository.php:174)
Magento\Quote\Model\QuoteRepository\Interceptor->___callParent (vendor/magento/framework/Interception/Interceptor.php:58)
Magento\Quote\Model\QuoteRepository\Interceptor->Magento\Framework\Interception\{closure:vendor/magento/framework/Interception/Interceptor.php:104-151} (vendor/magento/framework/Interception/Interceptor.php:138)
Magento\Quote\Model\QuoteRepository\Interceptor->___callPlugins (vendor/magento/framework/Interception/Interceptor.php:153)
Magento\Quote\Model\QuoteRepository\Interceptor->getActiveForCustomer (generated/code/Magento/Quote/Model/QuoteRepository/Interceptor.php:65)
Magento\Checkout\Model\Session\Interceptor->getQuote (vendor/magento/module-checkout/Model/Session.php:274)
Magento\Checkout\Model\Session\Interceptor->getQuote (generated/code/Magento/Checkout/Model/Session/Interceptor.php:63)
Magento\Checkout\CustomerData\Cart\Interceptor->getQuote (vendor/magento/module-checkout/CustomerData/Cart.php:116)
Magento\Checkout\CustomerData\Cart\Interceptor->getSectionData (vendor/magento/module-checkout/CustomerData/Cart.php:91)
Magento\Checkout\CustomerData\Cart\Interceptor->___callParent (vendor/magento/framework/Interception/Interceptor.php:58)
Magento\Checkout\CustomerData\Cart\Interceptor->Magento\Framework\Interception\{closure:vendor/magento/framework/Interception/Interceptor.php:104-151} (vendor/magento/framework/Interception/Interceptor.php:138)
Magento\Checkout\CustomerData\Cart\Interceptor->___callPlugins (vendor/magento/framework/Interception/Interceptor.php:153)
Magento\Checkout\CustomerData\Cart\Interceptor->getSectionData (generated/code/Magento/Checkout/CustomerData/Cart/Interceptor.php:26)
Magento\Customer\CustomerData\SectionPool->getSectionDataByNames (vendor/magento/module-customer/CustomerData/SectionPool.php:79)
Magento\Customer\CustomerData\SectionPool->getSectionsData (vendor/magento/module-customer/CustomerData/SectionPool.php:60)
Magento\Customer\Controller\Section\Load\Interceptor->execute (vendor/magento/module-customer/Controller/Section/Load.php:78)
Magento\Customer\Controller\Section\Load\Interceptor->execute (generated/code/Magento/Customer/Controller/Section/Load/Interceptor.php:24)
Magento\Customer\Controller\Section\Load\Interceptor->dispatch (vendor/magento/framework/App/Action/Action.php:108)
Magento\Customer\Controller\Section\Load\Interceptor->___callParent (vendor/magento/framework/Interception/Interceptor.php:58)
Magento\Customer\Controller\Section\Load\Interceptor->Magento\Framework\Interception\{closure:vendor/magento/framework/Interception/Interceptor.php:104-151} (vendor/magento/framework/Interception/Interceptor.php:138)
Magento\Customer\Controller\Section\Load\Interceptor->___callPlugins (vendor/magento/framework/Interception/Interceptor.php:153)
Magento\Customer\Controller\Section\Load\Interceptor->dispatch (generated/code/Magento/Customer/Controller/Section/Load/Interceptor.php:39)
Magento\Framework\App\FrontController\Interceptor->processRequest (vendor/magento/framework/App/FrontController.php:159)
Magento\Framework\App\FrontController\Interceptor->dispatch (vendor/magento/framework/App/FrontController.php:99)
Magento\Framework\App\FrontController\Interceptor->___callParent (vendor/magento/framework/Interception/Interceptor.php:58)
Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure:vendor/magento/framework/Interception/Interceptor.php:104-151} (vendor/magento/framework/Interception/Interceptor.php:138)
Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch (vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:94)
Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure:vendor/magento/framework/Interception/Interceptor.php:104-151} (vendor/magento/framework/Interception/Interceptor.php:135)
Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch (vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:73)
Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure:vendor/magento/framework/Interception/Interceptor.php:104-151} (vendor/magento/framework/Interception/Interceptor.php:135)
Magento\Framework\App\FrontController\Interceptor->___callPlugins (vendor/magento/framework/Interception/Interceptor.php:153)
Magento\Framework\App\FrontController\Interceptor->dispatch (generated/code/Magento/Framework/App/FrontController/Interceptor.php:26)
Magento\Framework\App\Http\Interceptor->launch (vendor/magento/framework/App/Http.php:137)
Magento\Framework\App\Http\Interceptor->launch (generated/code/Magento/Framework/App/Http/Interceptor.php:24)
Magento\Framework\App\Bootstrap->run (vendor/magento/framework/App/Bootstrap.php:261)
{main} (pub/index.php:40)

I'm not sure how important this problem is and what is breaks exactly. But it doesn't sound very good..

hostep commented 4 years ago

@ChintanKaneriya, you need them all, here they are combined: https://patch-diff.githubusercontent.com/raw/magento/magento2/pull/25307.diff or alternatively: https://github.com/magento/magento2/commit/2c43b82f624806d163ffc598cb6d2f8c3ea0c420

wajahatbashir commented 3 years ago

I am still facing same issue in Magento 2.4.0. anyone can tell me how to i can fix this issue ? account-information

arnoudhgz commented 3 years ago

@wajahatbashir your error seems to have a different cause. The problem of this issue was not shown on the frontend, but only in the logs (which was a false positive). It also stated a customerid, while it shows empty in your screenshot.

It seems like your screenshot is from the account edit page, but you are not actually showing an url. I would suggest asking help on stackexchange, since this does not seem a bug in Magento.

If it is a bug in Magento don't hesitate to create a new issue with proper steps to reproduce it.

hershkoy commented 3 years ago

For what is worth, we started getting this issue as well few days ago. Eventually we found that disabling the newsletter made the error disappear (It was part of 3rd party plugin)

Calvin495 commented 3 years ago

We are getting "No such entity with quote_id" when we are trying to place an order and not able to place the order at all. Magento version is 2.3.5-p1. I have checked "vendor/magento/module-checkout/Model/Session.php" and looks like the patch is already implemented in that file but still we are getting error.

KarunaKhatri2 commented 3 years ago

Getting same error No such entity id = in b2b Company Edit

_construct/var/www/html/Project/vendor/magento/module-company/Model/CompanyRepository.php:83 - singleField/var/www/html/Project/vendor/magento/framework/Interception/Interceptor.php:58 - get/var/www/html/Project/vendor/magento/framework/Interception/Interceptor.php:138

it's showing problems in this line throw NoSuchEntityException::singleField('id', $companyId);

if (!$company->getId()) { throw NoSuchEntityException::singleField('id', $companyId); }

        Please help me. 
martin-landhi commented 1 year ago

@KarunaKhatri2 @Calvin495 Did you find any fix here? it is happening to me after make an upgrade and i dont know if it is an issue on the database or what

dchaykas commented 5 months ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 5 months ago

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

magento-deployment-service[bot] commented 5 months ago

Hi @dchaykas, here is your Magento Instance: https://9df5969661b4e099a968198e25b3f400.instances-prod.magento-community.engineering Admin access: https://9df5969661b4e099a968198e25b3f400.instances-prod.magento-community.engineering/admin_6713 Login: 066af785 Password: a230be56ca7d