Skip to content

Magento does not set the customer session data correctly. #6759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
apurv-anand opened this issue Sep 27, 2016 · 12 comments
Closed

Magento does not set the customer session data correctly. #6759

apurv-anand opened this issue Sep 27, 2016 · 12 comments
Assignees
Labels
bug report Component: Customer Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Progress: needs update

Comments

@apurv-anand
Copy link

apurv-anand commented Sep 27, 2016

Magento does not set the customer session data correctly.

Issue: After logging in, the customer name in the welcome message (Welcome ) does not get set. At the time of checkout, user is asked to login again. The mini cart does not show the number of products that were added by the customer.

Environment:
Magento: M 2.1.1
Cache: Varnish 4 (only FPC disabled) - Prod mode.
OS version: Ubuntu 14.04.4 LTS
PHP: PHP 7.0.9 (Zend Engine: v3.0.0.)
Apache: Apache/2.4.23
AWS - Bitnami installation.
10K+ SKUs

Steps:

  • Install M2.1.1 on the above stack.
  • Create customer login.
  • Login.
  • The customer name in welcome message is not set.
  • Add product to cart - the mini cart number does not get updated.
  • Checkout - the customer will be asked to login again.

On random browsing thru the site, the name gets set (I am not able to figure out what causes it to set) and then its all fine - the name appears and the mini cart is updated.

This is a consistent issue and can be reproduced every time.

Please treat this as high priority. The sales are getting impacted because of this. Suggest a workaround if any.

@sevos1984
Copy link
Contributor

I can't reproduce this. Ensure you have permissions set correctly, try clearing magento and browser caches.

@apurv-anand
Copy link
Author

Please note that Full Page Cache (FPC) is disabled for now (and might have to keep it that way for sometime for a reason).
When we enable the FPC, the issue is less prominent, but we sill do not get a refresh automatically.

@itaymesh
Copy link
Contributor

itaymesh commented Oct 6, 2016

The issue also happens to me on Magento 2.1.1

@Morke3
Copy link

Morke3 commented Oct 6, 2016

Yeah, for me also. But not all time (almost)

@sevos1984
Copy link
Contributor

Have you tried disabling varnish or change application mode?

@apurv-anand
Copy link
Author

Varnish is enabled. Mode is production.

@azeemism
Copy link

azeemism commented Oct 28, 2016

I also have the same issue. Frequency of occurrence is always.

Using

Magento 2.1.2
Composer install and upgraded from 2.1.1 to 2.1.2
Debian Jessie 8
PHP7.0 w/ opcache enabled
Mode is developer
Using redis - setup per devdocs
Using varnish - setup per devdocs, but have set,
php bin/magento cache:disable
All 3rd party extension disabled
Stock luma theme.

Steps to Reproduce:

  1. Have had the issue since composer install/upgrade.

What I see:

  1. Using Chrome inspect, nothing is listed in the span
<span class="customer-name" role="link" tabindex="0" data-toggle="dropdown" data-trigger-keypress-button="true" data-bind="scope: 'customer'" aria-haspopup="true" aria-expanded="false">
            <span data-bind="text: customer().fullname"></span>
            <button type="button" class="action switch" tabindex="-1" data-action="customer-menu-toggle">
                <span>Change</span>
            </button>
        </span>
  1. 2016-10-27 21_44_28-my account

Picture above is using porto ultimate theme, but the same thing happens with the luma theme even when all 3rd party modules are disabled.

2016-10-27 22_09_46-

What I expect to see:

  1. There should be some customer name listed when logged in:
    <span data-bind="text: customer().fullname"> some name </span>

which should display the missing name in the ul.header.links and or div.panel.header

  1. Welcome message with customer name

Supplementary info:

I have not tested for issues with the cart.

@sevos1984
Copy link
Contributor

This should be fixed in develop branch 861f596. Could you please try this fix.

@azeemism
Copy link

azeemism commented Nov 1, 2016

@sevos1984 , with 861f596 the customer name and welcome message display after 3 seconds. Good work!

Any reason that there is a delay of 2-3 seconds? Anything I can do to shorten this length of time?

Note: I am running in developer mode with php bin/magento cache:disable
Note: I have not tested the mini cart or the re-login at checkout issue mentioned

I modified ./vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php

since app/code/Magento/PageCache/Model/App/FrontController/BuiltinPlugin.php does not exist on a composer install.

The file is modified per the fix as follows:

    public function aroundDispatch(
        \Magento\Framework\App\FrontControllerInterface $subject,
        \Closure $proceed,
        \Magento\Framework\App\RequestInterface $request
    ) {
        $this->version->process();
        if (!$this->config->isEnabled() || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN) {
            return $proceed($request);
        }
        $result = $this->kernel->load();
        if ($result === false) {
            $result = $proceed($request);
            if ($result instanceof ResponseHttp) {
                $this->addDebugHeaders($result);
                $this->kernel->process($result);
            }

Then,

rm -rf ${webroot}/var/view_preprocessed/* ${webroot}/pub/static/*
rm -rf ${webroot}/var/cache/* ${webroot}/var/page_cache/* ${webroot}/var/generation/* ${webroot}/var/di/*
php bin/magento cache:disable
php bin/magento cache:flush
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento --ansi setup:static-content:deploy en_CA
php bin/magento indexer:reindex
php bin/magento cache:flush

Then,

systemctl restart nginx php7.0-fpm
systemctl restart 'varn*'

@sevos1984
Copy link
Contributor

With enabled cache and production mode this should run faster. You can also enable Merge JavaScript Files, JavaScript Bundling or Minify JavaScript Files to accelerate js. For more information regarding performance configuration contact Community Forums or the Magento Stack Exchange. Thanks.

@ghost
Copy link

ghost commented Dec 8, 2017

I've faced this issue after enabling varnish. Anyone solved this issue.

@magento-engcom-team magento-engcom-team added the Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed label Dec 8, 2017
@maniramav
Copy link

Magento 2.3.2, In /vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php already have following code. Still asking customer to re-login.
if (!$this->config->isEnabled() || $this->config->getType() != \Magento\PageCache\Model\Config::BUILT_IN) { return $proceed($request); }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug report Component: Customer Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed Progress: needs update
Projects
None yet
Development

No branches or pull requests

8 participants