2

I am getting this error on a page enter image description here 1 exception(s): Exception #0 (Magento\Framework\Exception\RuntimeException): Type Error occurred when creating object: Magento\Search\Model\EngineResolver, Argument 2 passed to Magento\Search\Model\EngineResolver::__construct() must be of the type array, null given, called in /var/www/html/vendor/magento/framework/ObjectManager/Factory/AbstractFactory.php on line 121

I am not sure how to fix this error ? any suggestions ?

1
  • any thoughts on this please ?
    – magedev
    Oct 11 '21 at 7:14
2
+25
  • First : Try to rm -rf generated/ then bin/magento setup:di:compile to be sure your generated code is the good one.

  • If the error persist you might have an issue in your magento installation ? I would recommend to make sure your composer dependencies is up do date with the vendor.

  • Quick fix if nothing works try to setup an empty array for the required null parameter and see what happens after compilation ?

7
  • Thanks for the advice. i am using magento 2.4.3 though Elastic search is not yet installed. i have disabled Elasticsearch extensions. I have debugged with disabling extension one by one to find out exact error. its related to elasticsearch.
    – magedev
    Oct 11 '21 at 8:33
  • If you disabled some module that are required by others modules, it might make sense that it's not working. I'm not saying that's what is happening but it might be. What was your error with ES ?
    – Claims
    Oct 11 '21 at 8:39
  • Exception #0 (BadMethodCallException): Missing required argument $adapters of Magento\Search\Model\AdapterFactory.
    – magedev
    Oct 11 '21 at 8:40
  • The above error i am facing.
    – magedev
    Oct 11 '21 at 8:48
  • This error basically means once again a constructor is called with a missing parameter. Which is usually due to a wrong code (but I assume your code is fine) or a not compiled code then setup di compile does the trick. Eventually try to make sure the ES modules are well activated : bin/magento module:enable Magento_Elasticsearch6 Magento_Elasticsearch Magento_Elasticsearch7 cause basically the above errors is magento telling you he need elastic.
    – Claims
    Oct 11 '21 at 8:56
2

You need to follow this steps :

  1. Confirm the Elasticsearch is configured and running properly for magento 2.4.3

  2. Try to run this command.

     php bin/magento cache:clean
     php bin/magento cache:flush
     php bin/magento indexer:reindex
     php bin/magento setup:upgrade
     php bin/magento setup:static-content:deploy -f
    
     php bin/magento setup:di:compile
    
     sudo chmod -R 777 var/ generated/ pub/
    
  3. Still It show the error then according to your screenshot, disable all the extension from "Amasty" and then check it.

  4. Still it not resolve then disable all third party extension first, then enable one by one and debug from where this issues comes.

1

Elasticsearch is required for latest Magento installations, it won't work without it.

You can work towards building your own mysql search after removing search functionality entirely for Magento along with elasticsearch if you do want to remove elasticsearch. If you want to go that route you can follow this blog post - https://www.yireo.com/blog/2020-09-26-removing-search-from-magento2

Also a heads up if you do want to install elasticsearch now, there have been people before reporting issues that the elasticsearch does not work if you install it after installing Magento. So, you might have to disable and then enable the Elasticsearch modules or in the worst case scenerio install the Magento again.

0

Try following mostly used methods to resolve these errors:

if you are on linux go to magento root directory where you have installed than try below cmds:

  1. sudo chmod -R 777 *
  2. rm -rf pub/static/*
  3. php bin/magento setup:upgrade
  4. php bin/magento setup:di:compile
  5. php bin/magento indexer:reindex
  6. php bin/magento cache:flush

Make sure your elastic search is active check elastic search: sudo systemctl status elasticsearch

If you are stilling facing same issue share ss

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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