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.57k stars 9.32k forks source link

If the /customer/section/load call is not made before the user adds a item to the cart, you get an error #21049

Closed justinharris1986 closed 5 years ago

justinharris1986 commented 5 years ago

Preconditions

  1. Magento 2.2.7
  2. Slow server/Connection

Steps to reproduce

  1. Load a (in stock) product in to magento
  2. with a fresh session navigate directly to that product. (You can navigate to it from the homepage/menu however it is more difficult to trigger this bug.) It is helpful to turn on throttling in your developer tools in Chrome or FF before you visit the page to simulate a poor network connection. image
  3. quickly add that product to the cart, before /customer/section/load is called.
  4. Observe the "your session expired" error

Expected result

  1. Product adds to the cart successfully

Actual result

  1. image

once the PHPSESSID and the form_key cookies are set this is no longer an issue. It appears that these cookies are set when the browser calls "GET /customer/section/load/" image

This becomes more of an issue with a slow server, Lots of products/scripts, or a slow/latent/poor connection 2 thoughts on fixing this:

  1. have Magento create PHPSESSID and the form_key cookies if they are missing, and then add the product to the cart (preferred - this will help fix other timeouts, say when they leave their browser idle, and the session times out)
  2. have this call launch sooner, still may run in to a race condition

This becomes an issue when people land directly on a product page, say from google adwords. The more a user clicks around on the site, the more likely these cookies will be set.

magento-engcom-team commented 5 years ago

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

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-engcom-team give me 2.3-develop instance - upcoming 2.3.x release

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

@justinharris1986 do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

justinharris1986 commented 5 years ago

@magento-engcom-team give me 2.2-develop instance

magento-engcom-team commented 5 years ago

Hi @justinharris1986. Thank you for your request. I'm working on Magento 2.2-develop instance for you

magento-engcom-team commented 5 years ago

Hi @justinharris1986, here is your Magento instance. Admin access: https://i-21049-2-2-develop.instances.magento-community.engineering/admin Login: admin Password: 123123q Instance will be terminated in up to 3 hours.

justinharris1986 commented 5 years ago

@magento-engcom-team I was able to reproduce this in a 2.2-dev instance

magento-engcom-team commented 5 years ago

Hi @engcom-backlog-nazar. 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:

ghost commented 5 years ago

Hi @justinharris1986 thank you for you report, this issue has already fixed in 2.3-develop branch and will be available on 2.3.1 release

justinharris1986 commented 5 years ago

Good afternoon @engcom-backlog-nazar I appreciate you looking in to this. Are there any plans in fixing it in the 2.2.x branch?

csdougliss commented 5 years ago

@engcom-backlog-nazar Do you have a link to the PR please?

Webroju commented 5 years ago

Has someone found a solution for 2.2.x?