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

Magento 2.2.8 CE - Checkout Issue - Invalid state change requested - Customer getting emails about new order, but orders not creating in admin #27367

Closed perffectolt closed 4 years ago

perffectolt commented 4 years ago

Preconditions (*)

  1. Magento 2.2.8 CE
  2. Apache 2.4
  3. Mysql 5.7
  4. REDIS and Varnish
  5. Persistence cart enabled

Steps to reproduce (*)

  1. I am doing quick checkout as guest
  2. Using bank transfer payment

Expected result (*)

  1. Success on creating order in admin.

Actual result (*)

  1. When client trying to push CHECKOUT button, he is getting error "Invalid state change requested", but order confirmation emails are sending as many times as button were pushed.
  2. Order not creating in admin.
  3. Gettinf error in log

[2020-03-18 14:16:27] main.CRITICAL: Invalid state change requested {"exception":"[object] (Magento\Framework\Exception\StateException(code: 0): Invalid state change requested at /var/www/v2.kasiulai.lt/public_html/vendor/magento/module-quote/Model/QuoteRepository/Plugin/AccessChangeQuoteControl.php:45)"} []

  1. But when browser was closed and reopen to make the same order, everything were fine.
  2. All unsuccessful order numbers are skipped and not showwing in admin.
m2-assistant[bot] commented 4 years ago

Hi @perffectolt. 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 give me 2.4-develop instance - upcoming 2.4.x release

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

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


AndreyChorniy commented 4 years ago

Possible steps to reproduce:

  1. Enable checkout as guest
  2. Enable persistent shopping cart
  3. Create customer account
  4. Login to customer account
  5. Add product to cart
  6. Go to checkout
  7. Edit PHPSESID cookie and set a different value, or delete the cookie. The main idea is to get a different session (as if your current session expired for various reasons), meaning you will no longer be logged in but persistence will keep your current customer data.
  8. Refresh page. If redirected to empty cart use mini cart to go back to back to checkout. May have to try multiple times, sometimes it does not work from the first try.
  9. Fill checkout form data and place an order. You will receive "Invalid state change requested"
AndreyChorniy commented 4 years ago

@magento give me 2.4-develop instance

magento-engcom-team commented 4 years ago

Magento instance deployment temporary unavailable due to service maintenance.

m2-assistant[bot] commented 4 years ago

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

engcom-Lima commented 4 years ago

Hello @AndreyChorniy @perffectolt Could you provide more details for reproduce this issue?

I checked this case on Magento 2.4

  1. Enable checkout as guest
  2. Enable persistent shopping cart
  3. Create customer account
  4. Login to customer account
  5. Add product to cart (Simple product)
  6. Go to checkout
  7. Edit or delete PHPSESID cookie
  8. Refresh page

Result: After edited PHPSESID cookie and set a different value, or delete the cookie and page refreshing the new session will start. But persistence will keep current customer data and mini cart will not be empty.

Note: If customer isn`t logged in, the cart will be empty after refreshing the page. I cannot use the mini cart to go back to checkout. Thank you!

AndreyChorniy commented 4 years ago

@magento give me 2.4-develop instance

magento-engcom-team commented 4 years ago

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

magento-engcom-team commented 4 years ago

Hi @AndreyChorniy, here is your Magento instance. Admin access: https://i-27367-2-4-develop.instances.magento-community.engineering/admin_e4eb Login: a78057c6 Password: 7c064dc5803c Instance will be terminated in up to 3 hours.

AndreyChorniy commented 4 years ago

Hello @engcom-Lima, I have provided possible steps to reproduce which worked for me on Magento 2.3.*. But I have checked this on Magento 2.4-develop and it seems that this is already fixed.

engcom-Lima commented 4 years ago

Hello @AndreyChorniy @perffectolt Can this issue be closed since it has already been fixed?

engcom-Lima commented 4 years ago

@AndreyChorniy @perffectolt, we are closing this issue due to inactivity. If you'd like to update it, please reopen the issue.

giantdev commented 4 years ago

Having same issue on 2.3.3, any patches available for 2.3.3?

erikhansen commented 3 years ago

I'm also interested in a solution for this for Magento 2.3.4-p2.

ronak2ram commented 3 years ago

@magento give me 2.4-develop instance

magento-deployment-service[bot] commented 3 years ago

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

magento-deployment-service[bot] commented 3 years ago

Hi @ronak2ram, here is your Magento Instance: https://5a3fd9f5f55e8707e6074759500b1d42-2-4-develop.instances.magento-community.engineering Admin access: https://5a3fd9f5f55e8707e6074759500b1d42-2-4-develop.instances.magento-community.engineering/admin_16e9 Login: 45c32fb9 Password: c62417c1787c

ronak2ram commented 3 years ago

@magento give me 2.4.2 instance

magento-deployment-service[bot] commented 3 years ago

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

magento-deployment-service[bot] commented 3 years ago

Hi @ronak2ram, here is your Magento Instance: https://5a3fd9f5f55e8707e6074759500b1d42-2-4-2.instances.magento-community.engineering Admin access: https://5a3fd9f5f55e8707e6074759500b1d42-2-4-2.instances.magento-community.engineering/admin_9afe Login: 2aeb51b2 Password: dd93a1805d26

PascalBrouwers commented 3 years ago

@perffectolt can you reopen this issue? We need the fix for 2.3.x

PascalBrouwers commented 3 years ago

I find this commit in 2.4: https://github.com/magento/magento2/commit/5b8ae5fa206822bd8701a9d20a2acabae28d3593#diff-2ea10600cbb348fc58af88b3056c7843a4dbcab7cda1dd9473096f4cbf7e162e

Stefan0x commented 3 years ago

I find this commit in 2.4: 5b8ae5f#diff-2ea10600cbb348fc58af88b3056c7843a4dbcab7cda1dd9473096f4cbf7e162e

^ This did not work for 2.3.3

I used https://github.com/magento/magento2/commit/27a1299b501f6a15f9758148d17b53edfc51504d which fixed it for 2.3.3.

rossparachute commented 1 year ago

Also occurring on v2.4.5-p1. With v3.4.1 of the official Stripe connector.

We're using Redis and Varnish as well. There does seem to be an ongoing issue at Checkout related to session data. In this case, the cart was being updated just prior to placing the order after user action.

There's similar stuff with ReCaptcha handshakes not being forwarded on, addresses being changed causing errors to be thrown or users logging in for Carts that were previously guests.

We've actually moved server due to an upgrade so I think there's definitely a code bug somewhere, it just might be only prevalent in a specific server setup.

brain-effect commented 1 year ago

I find this commit in 2.4: 5b8ae5f#diff-2ea10600cbb348fc58af88b3056c7843a4dbcab7cda1dd9473096f4cbf7e162e

^ This did not work for 2.3.3

I used 27a1299 which fixed it for 2.3.3.

With latest M2 2.4.4, we are experiencing duplicated orders being placed due to this issue, since the payments platform accepts the payment, but Magento throws the "Invalid state change requested" and does not redirect customer to success view.

@PascalBrouwers @Stefan0x I suspect the commits you mentioned are already applied to 2.4.4, so they problem might not be completely solved yet.

I also tested Quality Patch ACSD-48694 and it does not seem to help: https://experienceleague.adobe.com/docs/commerce-knowledge-base/kb/support-tools/patches/v1-1-27/acsd-48694-invalid-state-change-requested-error-prevents-customer-from-placing-order.html?lang=en