1

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.

1 Answer 1

0

the first thing to do is identify the error and you can do this by checking the error log in either your webserver log or magento

the message "message": "Internal server error" that we see in your graphql response means an error details must exist and that would tell you what the problem is.

Unfortunately, once you will have details, it is not clear what you will be finding and I cannot assure you whether it is a simple task or not

2
  • Added the error log in the question. No other information is there. Aug 10, 2022 at 8:47
  • I think I missed an important hint to give you: the jump from magento 1.* to magento 2.* is that big that it is bound to be something you need a developer to troubleshoot the issue. I have not used 1.* in a while and I would not know where to start in fact Aug 10, 2022 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.