-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Checkout /pay/token leads to 404 #2539
Comments
for sure related to that, but the token is generated when the cart is created. so quite interesting... can we somehow further dbeug? |
It also cannot be locks or runtime cache. the listing always queries the database and since said before, the token is generated on cart creation. |
We also have non existing token issues (users with old cart before there was the token feature) but this is not the issue here, the token is definitely available. I'm quite sure, that it's about the order state (as you can see, the state changed in the same second as the the user gets redirected). It's also not happening all the time, which is also a cache related indication to me. |
It doesn't really matter what state it is, as long as the order has a token, it has to be found. |
What if we add a specific function to the repository to get Order by Token and use that? Maybe the findOneBy does something weird there? |
The token is available, but the order has to be in state "order", which is most probably not the case since the state changed at the same time. |
no it hasn't, the Payment Controller only gets the Order, creates the Payment and redirects to payum. |
What if you visit the link later? Like if you thing it is a race-condition, it should work like a second later or so |
Not sure. I'll check it on monday. The only thing i know (and as you can see in the screenshot), the state (see version screenshot) changed in the same second then the access log recorded the 404 (see log screenshot). |
Btw! Maybe its a route issue? Coreshop delivers two routes with an almost same endpoint: /pay/{token} and /pay/{order}. |
Yes, also sounds reasonable. Maybe delete the old one? or change priorities? |
Jop, found it. The issue starts here: CoreShop/src/CoreShop/Bundle/FrontendBundle/Resources/install/pimcore/staticroutes.yml Lines 138 to 139 in f1f118c
All tokens of our failed orders are starting with a numeric character (See example above):
Removing the route |
Increasing the priority of the |
Yes, the prio should be switched also (the legacy route prio is currently higher than the new one). |
Ok, I will create a PR and do a release monday/tuesday |
Btw. with #2511, all existing carts can't be used for a valid checkout, because the token is missing. |
@solverat token will be generated here: https://github.com/coreshop/CoreShop/blob/4.0/src/CoreShop/Component/Order/Factory/OrderFactory.php#L43, that is in there since #2265 Should we still add a migration for missing tokens? |
or a fallback that if no token is there, create one first in the checkout controller |
if (!$order->getToken()) {
//Fallback for Orders/Carts without token (eg. legacy carts)
$tokenGenerator = new UniqueTokenGenerator();
$order->setToken($tokenGenerator->generate(10));
$order->save();
} In the checkout-controller before generating the payment route |
I'll open another issue for that! |
To confirm: It's still better to remove the |
yes. |
we kept it for BC reasons, in case somebody uses it in custom overrides |
We currently struggle with a serious issue. On a P11 Installation, we receive a lot of failed orders without any error logs. After checking a lot of access logs, I found a coherence.
All these failed orders are coming from a 404 when entering
/_locale/shop/pay/{token}}
:A status 404 can be thrown here:
CoreShop/src/CoreShop/Bundle/PayumBundle/Controller/PaymentController.php
Lines 47 to 64 in f1f118c
After checking the order versions:
![image](https://private-user-images.githubusercontent.com/700119/303708757-ed49509d-5b37-41d8-bafb-ffb0d5adcaf6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjAwNjk5NTksIm5iZiI6MTcyMDA2OTY1OSwicGF0aCI6Ii83MDAxMTkvMzAzNzA4NzU3LWVkNDk1MDlkLTViMzctNDFkOC1iYWZiLWZmYjBkNWFkY2FmNi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzA0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcwNFQwNTA3MzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0xZjRkZGI3ZGZkNmI4MDU4YTUwN2M5NzkwM2U1NmM0MWQ5OWYwNWMzYmMxZjU0NTY4MWNlZDQ5YTQyMTZjYTBjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.wzByNbkxtiuyrCEDfZTQOpLU6a0Sn4fBHSCFB-LpN38)
On exact 12:25:21, the order changes its state from
cart
toorder
. If the time is right,orderRepository()->findOneBy()
won't find any order because of… I'm not sure? Runtime-Cache? Cache generally? Locks?Any help would be appreciated!
The text was updated successfully, but these errors were encountered: