Open
Description
Preconditions and environment
- Magento version 2.4.7-p1 (latest for now)
- OpenSearch search engine configured and used by Magento
Steps to reproduce
- Install vanilla Magento
- Create DropDown attribute with code test_ddl and options: Option 1, Option 2, Option 3 and Values Required: No
- Set attribute parameters
- Use in Search: Yes
- Use in Layered Navigation: Filterable (with results)
- Use in Search Results Layered Navigation: Yes
- Visible on Catalog Pages on Storefront: Yes
- Used in Product Listing: Yes
- Add attribute test_ddl to default Attribute set
- Create new product in admin with SKU simple-null
- Add Price, Stock, Category. Set test_ddl to Option 1
- Save product
- Open edit product form again and change test_ddl to empty value https://prnt.sc/9BdefPLEi8M4
- Reindex all indexes
bin/magento ind:reind
Please make sure they all reindexed successfully - Open any graphql client and make query
query {
products(
search: "simple"
) {
total_count
items {
name
sku
custom_attributesV2(filters: {is_visible_on_front: true}) {
items {
code
... on AttributeValue {
value
}
... on AttributeSelectedOptions {
selected_options {
value
}
}
}
}
}
aggregations{
attribute_code
options{
value
}
}
page_info {
page_size
current_page
}
}
}
Expected result
There is list of products with the simple-null product in it.
There is no error
Actual result
There is error in response
"errors": [
{
"message": "Internal server error",
"locations": [
{
"line": 12,
"column": 13
}
],
"path": [
"products",
"items",
3,
"custom_attributesV2"
]
}
],
Check exception.log and see error:
[2024-06-27T10:00:50.656107+00:00] main.ERROR: Magento\EavGraphQl\Model\Output\Value\GetAttributeValueComposite::execute(): Argument #3 ($value) must be of type string, null given, called in /home/zak/sites/magento/test1/public/vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/ProductCustomAttributes.php on line 122
GraphQL (12:13)
11: sku
12: custom_attributesV2(filters: {is_visible_on_front: true}) {
^
13: items {
{"exception":"[object] (GraphQL\\Error\\Error(code: 0): Magento\\EavGraphQl\\Model\\Output\\Value\\GetAttributeValueComposite::execute(): Argument #3 ($value) must be of type string, null given, called in /home/zak/sites/magento/test1/public/vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/ProductCustomAttributes.php on line 122 at /home/zak/sites/magento/test1/public/vendor/webonyx/graphql-php/src/Error/Error.php:170)
[previous exception] [object] (TypeError(code: 0): Magento\\EavGraphQl\\Model\\Output\\Value\\GetAttributeValueComposite::execute(): Argument #3 ($value) must be of type string, null given, called in /home/zak/sites/magento/test1/public/vendor/magento/module-catalog-graph-ql/Model/Resolver/Product/ProductCustomAttributes.php on line 122 at /home/zak/sites/magento/test1/public/vendor/magento/module-eav-graph-ql/Model/Output/Value/GetAttributeValueComposite.php:34)"} []
Additional information
Issue is because \Magento\EavGraphQl\Model\Output\Value\GetAttributeValueInterface::execute hase third paremeter $value of type string when null value received.
Note: Just so you know, the problem is not only with null/string. There is also a problem with any other value type other than string. For example if value is int there will be the same error.
I found the same issue when I added the quote address custom attribute with int type. When setting this attribute value using setShippingAddressesOnCart and retrieving the shipping address it also failed.
Release note
No response
Triage and priority
- 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.
- 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”.