Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Enabe the acquia search module
TypeError: Argument 1 passed to Drupal\acquia_search\EventSubscriber\SearchSubscriber::preExecuteRequest() must be an instance of Drupal\search_api_solr\Solarium\EventDispatcher\EventProxy, instance of Solarium\Core\Event\PreExecuteRequest given in modules/contrib/acquia_search/src/EventSubscriber/SearchSubscriber.php on line 72 #0 [internal function]: Drupal\acquia_search\EventSubscriber\SearchSubscriber->preExecuteRequest(Object(Solarium\Core\Event\PreExecuteRequest), 'Solarium\\Core\\E...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
EventProxy
Comment | File | Size | Author |
---|---|---|---|
#17 | 3217779_bc.patch | 1.98 KB | mkalkbrenner |
#11 | 3217779_composer.patch | 2.41 KB | mkalkbrenner |
#10 | 3217779.patch | 1.93 KB | mkalkbrenner |
Comments
Comment #2
hugronaphor CreditAttribution: hugronaphor at Acrosto for University of Dundee commentedLooks like the 4.1.12 release of search_api_solr is causing it.
Sticking to 4.1.11 prevents the reported issue.
Comment #3
djvern CreditAttribution: djvern commentedSame for me. I had to explicitly set and lock the version of search_api_solr in my site's composer.json as a work-around.
Comment #4
omarlopesinoThe changes that break Acquia search are introduced by this issue: https://www.drupal.org/project/search_api_solr/issues/3203214
More specifically, here, at the SearchApiSolrBackend constructor: https://git.drupalcode.org/project/search_api_solr/commit/1e9b55bcf#18a1...
This produces that if we are in Drupal 9.1 or higher, the instance received at that subscribe event is a PreExecuteRequest instance. So the solution could be modify
Drupal\acquia_search\EventSubscriber\SearchSubscriber::preExecuteRequest()
to support either Drupal\search_api_solr\Solarium\EventDispatcher\EventProxy or Solarium\Core\Event\PreExecuteRequest . Both classes contains the same methods, so it should be easy to fix.Comment #5
_KurT_ CreditAttribution: _KurT_ at FFW commentedchange 4.1.12 to 4.1.11 fixed issue for me.
Comment #6
phjouI also reverted to 4.1.11 since acquia_search is crashing most of the website.
Comment #7
aloknarwaria CreditAttribution: aloknarwaria commentedThanks, after reverting to the search_api_solr version to 4.1.11. Sites are working fine.
Comment #8
aloknarwaria CreditAttribution: aloknarwaria commentedComment #9
aloknarwaria CreditAttribution: aloknarwaria commentedComment #10
mkalkbrennerThe EventProxy must never be used as parameter type! The type should be EventInterface. Or, if you depend on search_api_solr > 4.1.12 you can use the specific solarium events.
Comment #11
mkalkbrennerI modified composer.json accordingly.
Comment #12
greggmarshall#11 applied and appears to have resolved the problem for us.
Thanks.
Comment #13
japerryThanks for the reports! We have a fix already pushed, and there will be a new release today.
Comment #14
sonfdSo, I'm updating to Solr 7 for the first time (per Acquia's instructions) and I'm seeing that this "fix" breaks this for Drupal 8.9 sites. I'm seeing the reverse of what's in the issue description.
Comment #15
mkalkbrennerI wasn't aware of the fact that the newer Solr versions are supported for "older" Drupal versions by Acquia. In this case it might be safer to use the Interface as type. instead of being concrete.
Comment #16
sonfdDowngrading to Search API Solr 4.1.11 and Acquia Search 3.0.2 resolved this for me on Drupal 8.9.
Comment #17
mkalkbrennerIt seems that this is the only backward compatible approach.
Comment #18
sonfdRe-upgrading to 3.0.3 with patch in #17 resolved the issue for me.
Comment #19
japerryOh thanks, committed. Not sure why our tests in d8 were passing with that. but yes, we support drupal 8.9 until it goes EOL.
Comment #20
joestewart CreditAttribution: joestewart at Mediacurrent commentedHi @japerry. I don't see a commit for this on the 3.x branch. Am I missing it?
Also do you plan a patch release including this issue?
thanks.
Comment #21
danflanagan8I'm still seeing this error with acquia_search v3.0.3/v3.0.4 and search_api_solr v4.1.12. I don't think the hotfix worked.
Update: I'm wrong of course! My site is still somehow using acquia_search_solr. I have some untangling to do.