Error when running indexing:

Notice: Undefined index: queries in /var/www/stage/vendor/magento/module-catalog-graph-ql/Plugin/Search/Request/ConfigReader.php on line 84
  • Did you ever find a resolution to this bug? I have the same error. When I debug the code and look at the query generated by getSearchableAttributes() I get 133 results in MySQL. But it never gets into the for loop... why???
    – PromInc
    Jul 25, 2020 at 18:17
  • yes in my case it was Mageplaza Admin Permissions extension issue, I was also stuck in the same case as you. But then I updated the extension and issue was resolved. Check the answer as well, that might help you out. Jul 27, 2020 at 6:53

1 Answer 1


I found that the root of the issue here is that a 3rd party module we installed had a bug in it that was preventing the indexer from finding product attributes.

The module was the MagePlaza Admin Permissions for Magento 2 module v1.0.0 They suggested I update to v1.0.1 and that resolved the issue.

In file vendor/mageplaza/module-admin-permissions/Plugin/Catalog/Model/ResourceModel/Product/Attribute/Collection.php, function beforeLoad() the indexer gets into this bit of code:

//hide all grid columns when user haven't permission to view product
if (!$this->helperData->isAllow('Mageplaza_AdminPermissions::product_attribute_view')) {

    return [$printQuery, $logQuery];

Adding that where condition tells the indexer that there aren’t any product attributes to use in the indexing process and throws the error.

One thing I learned in debugging this is how a product collection works a bit more... In vendor/magento/module-catalog-graph-ql/Plugin/Search/Request/ConfigReader.php I was analyzing the query that it is putting out where the error occurs using $productAttributes->getSelect()->__toString(). When I ran that query manually I would get 133 attributes.

The next line down calls foreach ($productAttributes->getItems() as $attribute) { and would not get into the for loop. How could I go from 133 to 0???

What I learned is that calling getItems() on a collection calls the load() function. This allows other observers to modify the query. In this case, the MagePlaza module was modifying the query via an observer.

So one debugging method that I learned here when trying to analyze the query a collection is using is to call the load() method before dumping out the query.


NOTE: technically you don't need ->__toString() as calling just $collection->getSelect() should work, but to me I'm used to calling the __toString() method from M1.

  • Exactly same issue with this extension. I was told to update it, so I updated it and issue was resolved. I was able to go till the for loop and was stuck there why the query was modifying. Then I contacted support and they told me to update the Mageplaza AdminPermission extension. Then it was resolved. Thanks, for this detailed explanation. Jul 27, 2020 at 6:52

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.