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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

aloknarwaria created an issue. See original summary.

hugronaphor’s picture

Looks like the 4.1.12 release of search_api_solr is causing it.
Sticking to 4.1.11 prevents the reported issue.

djvern’s picture

Same 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.

omarlopesino’s picture

Issue summary: View changes

The 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.

_KurT_’s picture

change 4.1.12 to 4.1.11 fixed issue for me.

phjou’s picture

I also reverted to 4.1.11 since acquia_search is crashing most of the website.

aloknarwaria’s picture

Thanks, after reverting to the search_api_solr version to 4.1.11. Sites are working fine.

aloknarwaria’s picture

Status: Active » Fixed
aloknarwaria’s picture

Issue summary: View changes
mkalkbrenner’s picture

Priority: Major » Critical
Status: Fixed » Needs review
FileSize
1.93 KB

The 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.

mkalkbrenner’s picture

Version: 3.0.2 » 3.x-dev
FileSize
2.41 KB

I modified composer.json accordingly.

greggmarshall’s picture

Status: Needs review » Reviewed & tested by the community

#11 applied and appears to have resolved the problem for us.

Thanks.

japerry’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the reports! We have a fix already pushed, and there will be a new release today.

sonfd’s picture

Status: Fixed » Needs work

So, 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.

TypeError: Argument 1 passed to Drupal\acquia_search\EventSubscriber\SearchSubscriber::preExecuteRequest() must be an instance of Solarium\Core\Event\PreExecuteRequest, instance of Drupal\search_api_solr\Solarium\EventDispatcher\EventProxy given in Drupal\acquia_search\EventSubscriber\SearchSubscriber->preExecuteRequest() (line 73 of /mnt/www/html/SITE/docroot/modules/contrib/acquia_search/src/EventSubscriber/SearchSubscriber.php)

  • Drupal 8.9.x
  • Search API 1.19
  • Search API Solr 4.1.12
  • Acquia Search 3.0.3
mkalkbrenner’s picture

I 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.

sonfd’s picture

Downgrading to Search API Solr 4.1.11 and Acquia Search 3.0.2 resolved this for me on Drupal 8.9.

mkalkbrenner’s picture

Status: Needs work » Needs review
FileSize
1.98 KB

It seems that this is the only backward compatible approach.

sonfd’s picture

Status: Needs review » Reviewed & tested by the community

Re-upgrading to 3.0.3 with patch in #17 resolved the issue for me.

japerry’s picture

Status: Reviewed & tested by the community » Fixed

Oh thanks, committed. Not sure why our tests in d8 were passing with that. but yes, we support drupal 8.9 until it goes EOL.

joestewart’s picture

Hi @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.

danflanagan8’s picture

I'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.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.