magento2
magento2 copied to clipboard
The requested store cannot be found caused Validate Hash from Store Switcher get false even the hash equal with signature and input hashData
Preconditions (*)
- Magento 2.4.x
- Create 2 stores view
Steps to reproduce (*)
- Try to switch Stores from Frontend or you could call it language switcher user interface not admin side.
- In specific condition the response time of the site could be more than 5s on load(API on load, or slow connection)
Expected result (*)
- Target store could be switched and no error found
Actual result (*)
- Target store is switched but found
The requested store cannot be found. Please check the request and try again. - Just wonder why https://github.com/magento/magento2/blob/2.4-develop/app/code/Magento/Store/Model/StoreSwitcher/HashGenerator.php#L109 the condition
time() - $timeStamp <= 5
exist for what?
- Possible to increase this number to 50 or a configuration as good
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- [ ] Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- [ ] Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- [ ] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [x] Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- [ ] Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Hi @tuyennn. Thank you for your report. To help us process this issue please make sure that you provided the following information:
- Summary of the issue
- Information on your environment
- Steps to reproduce
- Expected and actual results
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.
Please, add a comment to assign the issue: @magento I am working on this
- Join Magento Community Engineering Slack and ask your questions in #github channel.
:warning: According to the Magento Contribution requirements, all issues must go through the Community Contributions Triage process. Community Contributions Triage is a public meeting.
:clock10: You can find the schedule on the Magento Community Calendar page.
:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.
:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel
:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel
Hi @engcom-Alfa. 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:
-
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[ ] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! -
[ ] 5. Add label
Issue: Confirmedonce verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hi @tuyennn ,
I have tried on Magento 2.4 develop but I am able to switch to other stores without facing error .PFA.

Kindly review your steps to reproduce.
@engcom-Alfa That's completely a disappointed answer as I mentioned while your page request time is more than 5s by any specific reason. Switch store from the frontend is ok but the dumb error message would shown.
:white_check_mark: Confirmed by @engcom-Alfa
Thank you for verifying the issue. Based on the provided information internal tickets MC-42635 were created
Issue Available: @engcom-Alfa, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
HI @tuyennn As per the description, I understood like you are switching between the stores, and hence I have followed below steps to reproduce. Below steps followed as I understood :
- Created 2 new stores with new URL local.magento.us and local.magento.eu (where I am local.magento.com is being a default one)
- In the Admin > Dashboard page, Tried to change the scopes from one store to another, and it is absolutely working fine.
- In fact the new store local configuration with new websites is working fine in the front end.
Kindly elaborate your statement "Try to switch Stores from Frontend" for better understanding. Required a step by step reproducible steps possibly with screen shots and/or screen record. Please try it in the latest Magento version and reply with all the information.
@engcom-Alfa for sure we are talking about store switching or language switcher from frontend(user interface) not admin-side. You could see in the code line I mentioned above, the number 5 is hard coded as while my store has specific condition which a request response could be more than 5s on loading you will see the error message/ The question is why 5 but not 50 or 500? and when the hash value is corrected why we have to add 5s validation here,
Hi @tuyennn,
We tried to reproduce the issue but we are not getting the error , it works as expected. Please find the attached screenshots for reference.

Hence, added the label 'Needs update'.
@engcom-Delta Of course you cannot replicate it on regular conditions. I mentioned In specific condition the response time of the site could be more than 5s on load(API on load, or slow connection)
Hi @engcom-Hotel. 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:
-
[ ] 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).
Details
If the issue has a valid description, the labelIssue: Format is validwill be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is validappears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Descriptionlabel to the issue by yourself. -
[ ] 3. Add
Component: XXXXXlabel(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-developbranchDetails
- Add the comment@magento give me 2.4-develop instanceto deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-developbranch, please, add the labelReproduced on 2.4.x.
- If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here! -
[ ] 5. Add label
Issue: Confirmedonce verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @tuyennn,
We have tried to reproduce the issue in Magento 2.4-develop. As per your comment, that on a specific condition, the error has been occurred. So we have added PHP's sleep function and made the script to sleep for 10 seconds. We have made the changes in below file:
In this file, there is a constant named "TIMEOUT" set with 5 seconds, which we need to increase may be to resolve the issue.
I am marking this issue as a feature request as this is not a bug, but a feature enhancement.
Thanks
:white_check_mark: Confirmed by @engcom-Hotel
Thank you for verifying the issue. Based on the provided information internal tickets MC-42635 were created
Issue Available: @engcom-Hotel, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Hi @tuyennn
I have the same issue.
The Magento supporter can reproduce the issue by going to the checkout/cart page after switching stores.
If the request is greater than the TIMEOUT = 5 => the system will show an error
I changed the TIMEOUT = 50 but I have a new issue in the file.
https://github.com/magento/magento2/blob/bf4cdad2b1d0436be831c1f5c89c1adc77bfd1fc/app/code/Magento/Store/Model/StoreSwitcher/RedirectDataCacheSerializer.php#L83
This here can't get $json data therefore it shows a new exception.
Tuyen, Do you have the same issue?
@vbuiendertech sorry I no longer follow this, and we abandoned this old project with this issue. But in my case I suggest you to improve your performance as decrease server response < 5s avoid this.
Hi @tuyennn
Thank you for your response.
Yes, I have some customized unShareCart for multi-stores.
Maybe it is the reason for response > 5s.
I will optimize this but I still have an issue can't get $json from $cacheKey if the response < 5s while switching between stores.
I will find a solution to this issue.
Thank you so much.