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
di.xml
on this file - github.com/magento/magento2/issues/27112#issuecomment-606175216 this may work