1

I have facing issue in the system.log file to bulk up in GBs within couple of minutes. Upon in depth check, I found that Magento was logging warning main.WARNING: No such entity with addressId =.

I am using Magento ver. 2.2.4.

Below is the system.log file which is the continuously logging warning.

system.log

main.WARNING: No such entity with addressId =
# 0 /vhosts/www.mywebsite.com/webroot/vendor/magento/module-customer/Model/AddressRegistry.php(49): Magento\Framework\Exception\NoSuchEntityException::singleField('addressId', NULL)
# 1 /vhosts/www.mywebsite.com/webroot/vendor/magento/module-customer/Model/ResourceModel/AddressRepository.php(166): Magento\Customer\Model\AddressRegistry->retrieve(NULL)
# 2 /vhosts/www.mywebsite.com/webroot/vendor/vertex/module-tax/Model/AddressDeterminer.php(88): Magento\Customer\Model\ResourceModel\AddressRepository->getById(NULL)
# 3 /vhosts/www.mywebsite.com/webroot/vendor/vertex/module-tax/Model/AddressDeterminer.php(67): Vertex\Tax\Model\AddressDeterminer->getDefaultBilling('13366')
# 4 /vhosts/www.mywebsite.com/webroot/vendor/vertex/module-tax/Model/VertexUsageDeterminer.php(61): Vertex\Tax\Model\AddressDeterminer->determineAddress(Object(Magento\Customer\Model\Data\Address), '13366', true)
# 5 /vhosts/www.mywebsite.com/webroot/vendor/vertex/module-tax/Model/Plugin/TaxCalculationPlugin.php(132): Vertex\Tax\Model\VertexUsageDeterminer->shouldUseVertex('1', Object(Magento\Customer\Model\Data\Address), '13366', true)
# 6 /vhosts/www.mywebsite.com/webroot/vendor/vertex/module-tax/Model/Plugin/TaxCalculationPlugin.php(65): Vertex\Tax\Model\Plugin\TaxCalculationPlugin->useVertex(Object(Magento\Tax\Model\Sales\Quote\QuoteDetails), '1', true)
# 7 /vhosts/www.mywebsite.com/webroot/vendor/magento/framework/Interception/Interceptor.php(135): Vertex\Tax\Model\Plugin\TaxCalculationPlugin->aroundCalculateTax(Object(Magento\Tax\Model\TaxCalculation\Interceptor), Object(Closure), Object(Magento\Tax\Model\Sales\Quote\QuoteDetails), '1')
# 8 /vhosts/www.mywebsite.com/webroot/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Tax\Model\TaxCalculation\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Tax\Model\Sales\Quote\QuoteDetails), '1')

2 Answers 2

1

Have you try this solution?

check in \Magento\Customer\Model\AddressRegistry class

From this:

$address->load($addressId);
if (!$address->getId()) {
    throw NoSuchEntityException::singleField('addressId', $addressId);
}

To this

//if addressId is null or 0 we don't try to load it to avoid annoying log

      if($addressId != 0 && $addressId != null){
          $address->load($addressId);
           if (!$address->getId()) {
          throw NoSuchEntityException::singleField('addressId', $addressId);
           }
        }
0

If you receive the error message "No such entity.", "No such entity with" or "No such entity with customerId" in Magento 2, the issue usually occurred when you try to load not existing object via Magento 2 Repository Class.

It is usually caused by third-party Magento extensions. However, to have a broader picture you'll have to debug the vendor/magento/framework/Exception/NoSuchEntityException.php file.

To Debug, open the file vendor/magento/framework/Exception/NoSuchEntityException.php:

and at the beginning of the singleField() and doubleField() method temporary add debug backtrace code:

        $writer = new \Zend_Log_Writer_Stream(BP . '/var/log/mhtb.log');
        $logger = new \Zend_Log();
        $logger->addWriter($writer);
        $logger->info("==== No Such Entity Exception Debug ====");
    
        foreach (debug_backtrace() as $_stack) {
            $logger->info(print_r(($_stack["file"] ? $_stack["file"] : '') . ':' .
                ($_stack["line"] ? $_stack["line"] : '') . ' - ' .
                ($_stack["function"] ? $_stack["function"] : ''), true));
        
        }

Save the file and refresh the page or regenerate case.

You will see the debug backtrace that will allow you to define the issue source and you will get an idea how to fix it.

For me, It was: enter image description here

Usually Third Party Magento 2 Extensions lead up to this problem, so you can override their code and add "try-catch" exception or Fix it.

Don't forget to revert changes in NoSuchEntityException.php file after you're finished.

I hope this will help you. 😊

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.