Error "Call to a member function getValues() on null" preventing data to be indexed when Denormalization is enabled

Created on 4 November 2022, over 1 year ago
Updated 12 February 2024, 5 months ago

Problem/Motivation

Thanks for the module, I have a requirement and I think the denormalization is my solution.
I was testing the module and I found an error when indexing, it's caused by some validations that are missing, the error is the following:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /en/batch?id=5183&op=do_nojs&op=do
StatusText: OK
ResponseText: Error: Call to a member function getValues() on null in Drupal\search_api_grouping\Plugin\search_api\processor\Denormalize->alterIndexedItems() (line 126 of /app/docroot/modules/contrib/search_api_grouping/src/Plugin/search_api/processor/Denormalize.php).

Steps to reproduce

  1. Enable Denormalization in the Processors administration page (I had to apply a couple of patches to make this work https://www.drupal.org/files/issues/2021-10-28/3246441-5.patch β†’ and https://www.drupal.org/files/issues/2022-04-13/element_validate_integer_... β†’ )
  2. Choose some fields to use denormalization and save
  3. Reindex content

Proposed resolution

Add some validations around that line:

$field = $item->getField($field_name);
if (empty($field)) {
  continue;
}
$values = $field->getValues();

Remaining tasks

Test patch

πŸ› Bug report
Status

RTBC

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada efrainh

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024