When customer tried to login, there always error log in exception log, here's the error written in exception log :

main.CRITICAL: No such entity with customerId = {"exception":"[object] (Magento\Framework\Exception\NoSuchEntityException(code: 0): No such entity with customerId = at /var/www/html/example.com/public_html/vendor/magento/framework/Exception/NoSuchEntityException.php:49)"} []

Is there something wrong that made that error log?


1 Answer 1


We have the same your issue. On dashboard tab, we don't get the first-name and the email. But on another tab we get the email and first-name (with the same code on same a file)

You can try the below code to get current customer

use Magento\Customer\Helper\Session\CurrentCustomer;

    /** @var CurrentCustomer */
    protected CurrentCustomer $currentCustomer;

    public function __construct(
        CurrentCustomer $currentCustomer
    ) {
        $this->currentCustomer = $currentCustomer;

     * Returns the Magento Customer Model for this block
     * @return CustomerInterface|null
    public function getCurrentCustomer(): ?CustomerInterface
        try {
            return $this->currentCustomer->getCustomer();
        } catch (NoSuchEntityException $e) {
            return null;

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.