I am working with magento 2.4.4-p1. I got an error on calling the below graphQL query on the site.
query Route($url: String!) {
route(url: $url) {
redirect_code
relative_url
type
... on CategoryTree {
name
id
url_path
url_suffix
breadcrumbs {
category_name
category_url_path
category_uid
}
}
...on SimpleProduct{
...ProductFragment
}
}
}
fragment ProductFragment on SimpleProduct {
name
price_range {
minimum_price {
regular_price {
value
}
final_price {
value
}
}
}
description {
html
}
image {
url
}
media_gallery {
url
}
}
This is the error I received
{
"errors": [
{
"debugMessage": "Notice: Undefined property: GraphQL\\Language\\AST\\FragmentSpreadNode::$selectionSet in /var/www/html/mage244/vendor/magento/module-catalog-graph-ql/Model/Category/DepthCalculator.php on line 83",
"message": "Internal server error",
"extensions": {
"category": "internal"
},
"locations": [
{
"line": 2,
"column": 5
}
],
"path": [
"route"
]
}
],
"data": {
"route": null
}
}
This issue exists only with fragments. If I remove the fragments, then the query works successfully. This is the error in the log file
main.ERROR: Notice: Undefined property: GraphQL\Language\AST\FragmentSpreadNode::$selectionSet in /var/www/html/mage244/vendor/magento/module-catalog-graph-ql/Model/Category/DepthCalculator.php on line 83
GraphQL (2:5)
1: query Route($url: String!) {
2: route(url: $url) {
^
3: redirect_code
[] []
The same issue exists in Magento 2.4.5. Please help me to fix this.