-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
[Graphql] Type issue in 2.4.7 #38662
Comments
Hi @Nuranto. Thank you for your report.
Join Magento Community Engineering Slack and ask your questions in #github channel. |
Hi @engcom-Delta. Thank you for working on this issue.
|
Hi @Nuranto, Thank you for your reporting and collaboration. We have tried to reproduce the issue but we couldn't find GetCustomSelectedOptionAttributes mutation available. Can you provide us the mutation used in graphql to reproduce the issue. Thanks, |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-11878 is successfully created for this GitHub issue. |
Hi @Nuranto, We have tried to reproduce the issue but we couldn't find GetCustomSelectedOptionAttributes mutation available. Could you please provide us the mutation used in graphql to reproduce the issue. Thanks, |
I guess any query that retrieve |
Hi @Nuranto , We have tried to fetch customer attributes with Graphql and we are not able reproduce the error . Please find attached the screenshot and let us know if something is missed. |
I ran into this issue with a third party module that added a customer attribute of type boolean with Fix error on GraphQL customer query due to attribute type issue. See also https://github.com/magento/magento2/issues/38662
@package magento/module-customer-graph-ql
--- magento/module-customer-graph-ql/Model/Customer/GetCustomSelectedOptionAttributes.php.orig 2024-04-03 16:20:22
+++ magento/module-customer-graph-ql/Model/Customer/GetCustomSelectedOptionAttributes.php 2024-05-21 11:52:53
@@ -54,8 +54,11 @@
if (!in_array($option->getValue(), $selectedValues)) {
continue;
}
+ // Boolean attributes can actually give an `int` result here, so we must cast to string to avoid type error
+ // when encoding.
+ $value = (string) $option->getValue();
$result[] = [
- 'uid' => $this->uid->encode($option->getValue()),
+ 'uid' => $this->uid->encode($value),
'value' => $option->getValue(),
'label' => $option->getLabel()
]; To help with reproduction, the attribute was added as follows: $eavSetup->addAttribute(
Customer::ENTITY,
'rewards_subscription',
[
'type' => 'int',
'label' => 'Subscription to Points Expiring Notification',
'input' => 'select',
'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
'required' => true,
'default' => '1',
'sort_order' => 200,
'system' => false,
'position' => 200
]
);
$subscription = $this->eavConfig->getAttribute(Customer::ENTITY, 'rewards_subscription');
$subscription->setData(
'used_in_forms',
['adminhtml_customer']
); A simple query as belows triggered the error: query AccountDashboard {
__typename
customer {
email
__typename
}
} |
Preconditions and environment
Steps to reproduce
Expected result
No error
Actual result
Additional information
No response
Release note
No response
Triage and priority
The text was updated successfully, but these errors were encountered: