Open zakdma opened 5 months ago
Hi @zakdma. Thank you for your report. To speed up processing of this issue, make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, Add a comment to the issue:
@magento give me 2.4-develop instance
- upcoming 2.4.x release@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, join the Community Contributions Triage session to discuss the appropriate ticket.
Hi @engcom-Delta. 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:
Area: XXXXX
label to the ticket, indicating the functional areas it may be related to.2.4-develop
branch@magento give me 2.4-develop instance
to deploy test instance on Magento infrastructure. 2.4-develop
branch, please, add the label Reproduced on 2.4.x
.Issue: Confirmed
once verification is complete. 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.
Hi @zakdma ,
Verified the issue on 2.4-develop and we are not able to reproduce this issue.
Steps to reproduce:-
1.Install vanilla Magento 2.Create DropDown attribute with code test_ddl and options: Option 1, Option 2, Option 3 and Values Required: No 3.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 4.Add attribute test_ddl to default Attribute set 5.Create new product in admin with SKU simple-null 6.Add Price, Stock, Category. Set test_ddl to Option 1 7.Save product 8.Open edit product form again and change test_ddl to empty value 9.Open any graphql client and make query
created attribute
the values
added to default attribute set
product created and value saved to option 1
product edited value emptied and saved
no error
Please refer the attached screenshots and let us know if we missed anything.
Why am I getting this response? I did not report or comment on this.
Hey @engcom-Delta
Is far as I can see from your screenshots you are not using vanilla Magento. You Magento instance has a lot of attribute sets and maybe also other data, modules or configurations. Please use vanilla magento that can be installed like this
composer create-project --repository-url=https://repo.magento.com/ magento/project-community-edition public
Also please use OpenSearch as a search engine and reindex all indexes bin/magento ind:reind
before making graphql request
Please make sure they all reindexed successfully.
Regards.
Hi @zakdma ,
Verified the issue on 2.4-develop and we are not able to reproduce this issue.
Preconditions:-
OpenSearch search engine configured and used by Magento
Steps to reproduce:-
1.Install vanilla Magento 2.Create DropDown attribute with code test_ddl and options: Option 1, Option 2, Option 3 and Values Required: No 3.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 4.Add attribute test_ddl to default Attribute set 5.Create new product in admin with SKU simple-null 6.Add Price, Stock, Category. Set test_ddl to Option 1 7.Save product 8.Open edit product form again and change test_ddl to empty value 9.Reindex all indexes bin/magento indexer:reindex Please make sure they all reindexed successfully 10.Open any graphql client and make query
Created new attribute
added on default test attribute
Created new product
edited product
Reindex all indexes
Actual result: We are not getting internal server error
Please refer the attached screenshots and let us know if we missed anything.
Hey @engcom-Delta Don't you see an error on your screenshot? https://prnt.sc/j2P8ngjnBGGS Your request didn't return any result because of an indexation error. https://prnt.sc/T9jaBXFsuii6 That's why you don't see error 500
Can confirm that we've run into this exact same issue. I think it might be easiest to hit if you don't use any filters in the custom_attributesV2
query, but just try getting all the attributes.
@magento give me 2.4-develop instance
Hi @mattijv. Thank you for your request. I'm working on Magento instance for you.
Hi @mattijv, here is your Magento Instance: https://a9e3443cace74767d676b31ac81cd65a.instances-prod.magento-community.engineering Admin access: https://a9e3443cace74767d676b31ac81cd65a.instances-prod.magento-community.engineering/admin_333d Login: 6d5a72de Password: a8340e813218
I was able to reproduce the issue (not the exact same steps, but it's the same underlying issue) in the dev instance provisioned above.
Steps:
custom_attributesV2
field for that product.
Here's the query used for copypaste convenience:
{
products(filter: {sku: {eq:"24-WB04"}}) {
items {
sku
custom_attributesV2 {
items {
code
... on AttributeValue {
value
}
... on AttributeSelectedOptions {
selected_options {
value
}
}
}
}
}
}
}
Hi @zakdma,
Verified the issue on 2.4-develop and 2.4.7 and it is reproducible.
Hence, Confirming the issue.
Steps to reproduce:-
1.Install vanilla Magento 2.Create DropDown attribute with code test_ddl and options: Option 1, Option 2, Option 3 and Values Required: No 3.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 4.Add attribute test_ddl to default Attribute set 5.Create new product in admin with SKU simple-null 6.Add Price, Stock, Category. Set test_ddl to Option 1 7.Save product 8.Open edit product form again and change test_ddl to empty value 9.Reindex all indexes bin/magento indexer:reindex Please make sure they all reindexed successfully 10.Open any graphql client and make query
created attribute
attribute settings
attribute added to default attribute set
Created new product
edited product
reindexing
Graphql result
Exception log
:white_check_mark: Jira issue https://jira.corp.adobe.com/browse/AC-12328 is successfully created for this GitHub issue.
:white_check_mark: Confirmed by @engcom-Delta. Thank you for verifying the issue.
Issue Available: @engcom-Delta, You will be automatically unassigned. Contributors/Maintainers can claim this issue to continue. To reclaim and continue work, reassign the ticket to yourself.
:x: You don't have permission to export this issue.
Hey @engcom-Delta @mattijv Thank you for confirming the issue. The same problem can appear for any attribute value that is not a string. For example, I faced it for the int value, but the issue reproducing is a bit complicated. As far as I can see this resolver is implemented for product, customer and quote address attributes. There some workaround patches I created to make it working before issue fixed.
--- a/Model/Customer/Address/ExtractCustomerAddressData.php
+++ b/Model/Customer/Address/ExtractCustomerAddressData.php
@@ -162,7 +162,7 @@
return $this->getAttributeValue->execute(
AddressMetadataInterface::ENTITY_TYPE_ADDRESS,
$customAttribute['attribute_code'],
- $customAttribute['value']
+ (string)$customAttribute['value']
);
},
$attributes
--- a/Model/Resolver/Product/ProductCustomAttributes.php
+++ b/Model/Resolver/Product/ProductCustomAttributes.php
@@ -122,7 +122,7 @@
return $this->getAttributeValue->execute(
ProductAttributeInterface::ENTITY_TYPE_CODE,
$customAttribute['attribute_code'],
- $customAttribute['value']
+ (string)$customAttribute['value']
);
},
$customAttributes
--- a/Model/Cart/ExtractQuoteAddressData.php
+++ b/Model/Cart/ExtractQuoteAddressData.php
@@ -86,7 +86,7 @@
return $this->getAttributeValue->execute(
'customer_address',
$attribute->getAttributeCode(),
- $attribute->getValue()
+ (string)$attribute->getValue()
);
},
$address->getCustomAttributes() ?? []
:x: Cannot export the issue. This GitHub issue is already linked to Jira issue(s): https://jira.corp.adobe.com/browse/AC-12328
Encountered this issue today on a shop with a lot of customizations, therefore tested (and confirmed) this issue on a vanilla 2.4-develop
instance.
_PS Wondering why Magento took the approach using custom_attributesV2
anyway since it won't allow the correct usage of types in GraphQL (yay, everything a String
! 🤡 )_
Preconditions and environment
Steps to reproduce
bin/magento ind:reind
Please make sure they all reindexed successfullyExpected result
There is list of products with the simple-null product in it. There is no error
Actual result
There is error in response
Check exception.log and see error:
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