1

I am having issues with my company's Magento test site. The issues are when searching using Elastic search, the resulting page is a blank page. Then, when I look for relevant errors in various logs, I see the following PHP error in the /var/log/httpd/error_log file:

[php7:error] [pid 22228] [client xx.xxx.xxx.xxx:xxxxx] PHP Fatal error:  
    Uncaught TypeError: Argument 1 passed to Magento\\Elasticsearch\\Model\\Adapter\\FieldMapper\\Product\\AttributeProvider::getByAttributeCode() 
    must be of the type string, null given, called in /var/www/html/test/vendor/magento/module-elasticsearch/SearchAdapter/Query/Builder/Sort.php 
    on line 92 and defined in /var/www/html/test/vendor/magento/module-elasticsearch/Model/Adapter/FieldMapper/Product/AttributeProvider.php:72\nStack 
    trace:\n#0 /var/www/html/test/vendor/magento/module-elasticsearch/SearchAdapter/Query/Builder/Sort.php(92): 
    Magento\\Elasticsearch\\Model\\Adapter\\FieldMapper\\Product\\AttributeProvider->getByAttributeCode(NULL)\n#1 
    /var/www/html/test/vendor/magento/module-elasticsearch/Elasticsearch5/SearchAdapter/Query/Builder.php(91): 
    Magento\\Elasticsearch\\SearchAdapter\\Query\\Builder\\Sort->getSort(Object(Magento\\Framework\\Search\\Request))\n#2 
    /var/www/html/test/vendor/magento/module-elasticsearch/Elasticsearch5/SearchAdapter/Mapper.php(66): 
    Magento\\Elasticsearch\\Elasticsearch5\\SearchAdapter\\Query\\Builder->initQue in 
    /var/www/html/test/vendor/magento/module-elasticsearch/Model/Adapter/FieldMapper/Product/AttributeProvider.php 
    on line 72, referer: www.mytestsite.com

Does anyone have any ideas on how to solve this error?

Now, here is my test site's setup:

PHP version: 7.2.27

Magento version: 2.3.4 community edition

OS: CentOS 7.7.1908

Elasticsearch: 6.8.7-1

Also here is further information on my test site's setup: I performed an in-place upgrade where I created the test site from a base Magento 2.3.4 install. Then, added all of the modules I needed. Finally, I copied over a backup of my company's production database and ran the Magento upgrade and compile commands (e.g., "magento setup:upgrade" and "magento setup:di:compile"). And note the production database was based-on Magento 2.3.1.

Thanks in advance for any answer, suggestions, and/or help you can provide.

Regards,

Alvaro

4

2 Answers 2

0

This is magento issue. Fixed in https://github.com/magento/magento2/issues/27112#issuecomment-606175216

1
-1

You should disable module Magento\Elasticsearch

2
  • Thanks for the answer, unfortunately, when I try to disable the module Magento\Elasticsearch, I get an error saying that the Magento_Elasticsearch6 is dependent on this module. So, I have to disable the Elastic version 6 module first which does not help.
    – Alvaro
    Commented Apr 6, 2020 at 21:39
  • please find the line '89 file Sort.php' and run this command: 'if (in_array($item['field'], $this->skippedFields)) { => if (!$item['field'] || in_array($item['field'], $this->skippedFields)) {' Commented Apr 7, 2020 at 4:20

Your Answer

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

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