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.
When trying to run cron (http://***/admin/config/system/cron) I receive WSOD with an error related to search_api_facets.module.
Fatal error: Call to a member function entityWrapper() on a non-object
Debug info
Array
(
[type] => 1
[message] => Call to a member function entityWrapper() on a non-object
[file] => /***/sites/all/modules/search_api/contrib/search_api_facets/search_api_facets.module
[line] => 922
)
Environment
Comment | File | Size | Author |
---|---|---|---|
#1 | 1262362--facet-without-index-error-handling.patch | 1.3 KB | drunken monkey |
Comments
Comment #1
drunken monkeyI'm pretty sure where the problem lies: you seem (for whatever reason) to still have facets for an already deleted index, resulting in this error.
For catching this and avoiding the fatal error, please test the attached patch.
Then, for cleaning up your data, execute the following SQL statement:
DELETE FROM search_api_facet WHERE index_id NOT IN (SELECT machine_name FROM search_api_index)
(Of course, add the appropriate table prefixes if you have one defined.)
Comment #2
drunken monkeyComment #3
Refineo CreditAttribution: Refineo commentedComment #4
Refineo CreditAttribution: Refineo commentedThe cron run successfully after deleting obsolete records (above).
Now testing the patch for error handling (after creating some test data)...
Comment #5
Refineo CreditAttribution: Refineo commentedApplying the patch makes no harm to the module but I cannot get the error handling message even after removing indices and leaving facet data so I cannot fully confirm the new code handles errors.
Comment #6
drunken monkeyYes, that's why I suggested to do it in the other order. Anyways, I'm pretty sure this fixes at least that instance of the bug.
Also, since we will very soon abandon the Facets module anyways (see #1182614: Integrate with Facet API), more complicated bug fixing would be wasted anyways.
Committed this, thanks for reporting and testing!
Comment #7
miiimoooSorry re-opening. I just upgrade a site from my dev version to the current recommended one 1.0-beta9 and now I'm stuck with this error..
EDIT: all my facets refer to the same existing index
Comment #8
drunken monkey1) Beta 10 is the recommended version.
2) If it's not in the dev version, I can't do anything about it. The dev version already catches this error.
Weird, though, that this should occur with valid facets. However, I could imagine that
search_api_index_load()
in general doesn't work for you at the moment, if the entity type information is outdated. To fix, executecache_clear_all('entity_info:', 'cache', TRUE);
(or manually delete those entries from the cache table).Comment #9
miiimoooJust to confirm the 'fixed': I got this error I think mainly because I hadn't upgraded entity API. Upgrading everything (search_api, search_api_solr, entity) in one go to beta10 worked!