magento2
magento2 copied to clipboard
[GraphQL] Store validation executes after defining current store
During working on https://github.com/magento/magento2/pull/31263 we found that just making General session a proxy instead of the regular object causing GraphQL web API test failures.
During my investigation (details in https://github.com/magento/magento2/pull/31263#issuecomment-747499196), we found that for some reason the method that sets the current store is executing BEFORE the method that does validation for that store and not doing any validation inside (so it's not failing).
As result - any code on later steps will fail when it will try to get the current Store ($this->scopeCodeResolver->resolve('store', 'null')
) and fails with NoSuchEntityException.
Note 1: as a workaround in scope of https://github.com/magento/magento2/pull/31263 we added following line to the app/code/Magento/GraphQl/etc/graphql/di.xml, that should be removed once this issue will be resolved.
<preference for="Magento\Framework\Session\SessionManagerInterface" type="Magento\Framework\Session\Generic" />
Note 2: seems like the following change also not required in the scope of the GraphQL area and was added as a workaround to this issue, need to double-check that also: https://github.com/magento/magento2/pull/26032/files#diff-5a258589534652449d6d2a5484b3f175168b02d80722ac29aee29669ab371f37R10
Preconditions (*)
- Magento 2.4-develop
Steps to reproduce (*)
- Set breakpoint on
Magento\StoreGraphQl\Controller\HttpRequestValidator\StoreValidator::validate
- Set breakpoint on
\Magento\StoreGraphQl\Controller\HttpHeaderProcessor\StoreProcessor::processHeaderValue
- Execute ANY graphql request with a Store header.
Expected result (*)
-
Magento\StoreGraphQl\Controller\HttpRequestValidator\StoreValidator::validate
should be executed first -
\Magento\StoreGraphQl\Controller\HttpHeaderProcessor\StoreProcessor::processHeaderValue
should be executed 2nd
Actual result (*)
-
\Magento\StoreGraphQl\Controller\HttpHeaderProcessor\StoreProcessor::processHeaderValue
executes 1st -
Magento\StoreGraphQl\Controller\HttpRequestValidator\StoreValidator::validate
should be executed 2nd
Aditional info from Engcom
Use, for example, the following GraphQL mutation
mutation {
createCustomer(
input: {
prefix: "Prince"
firstname: "John"
suffix: "IV"
middlename: "Ruel"
lastname: "Doe"
email: "[email protected]"
gender: 1
password: "123123qA"
}
) {
customer {
firstname
lastname
email
}
}
}
With HTTP Header
{
"Store": "default"
}
Breakpoint in file .../app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php
Breakpoint in file .../app/code/Magento/StoreGraphQl/Controller/HttpRequestValidator/StoreValidator.php
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.
- [x] Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- [ ] 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 @ihor-sviziev. 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-Bravo. 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 valid
will be added to the issue automatically. Please, edit issue description if needed, until labelIssue: Format is valid
appears. -
[ ] 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add
Issue: Clear Description
label to the issue by yourself. -
[ ] 3. Add
Component: XXXXX
label(s) to the ticket, indicating the components it may be related to. -
[ ] 4. Verify that the issue is reproducible on
2.4-develop
branchDetails
- Add the comment@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure.
- If the issue is reproducible on2.4-develop
branch, 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: Confirmed
once verification is complete. -
[ ] 6. Make sure that automatic system confirms that report has been added to the backlog.
Hello @ihor-sviziev
Thank you for your report.
We Confirm the issue, and we have added Additional info form Engcom to the Description
Thank you
:white_check_mark: Confirmed by @engcom-Bravo
Thank you for verifying the issue. Based on the provided information internal tickets MC-40260
were created
Issue Available: @engcom-Bravo, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
Hi @ihor-sviziev Development team is working on this issue. Thank you.
Hello,
As I can see this issue got fixed in the scope of the internal Jira ticket AC-821 by the internal team Related commits: https://github.com/search?q=repo%3Amagento%2Fmagento2+AC-821&type=commits
Based on the Jira ticket, the target version is 2.4.7-beta1.