Problem/Motivation

Salesforce pull queue generates this error:
Error: Call to a member function size() on null en Drupal\salesforce_pull\QueueHandler->getUpdatedRecordsForMapping()

Steps to reproduce

Cron execution

Proposed resolution

Current code is:

public function getUpdatedRecordsForMapping(SalesforceMappingInterface $mapping, $force_pull = FALSE, $start = 0, $stop = 0) {
    ...
    $results = $this->doSfoQuery($mapping, [], $start, $stop);
    if ($results) {
      $this->enqueueAllResults($mapping, $results, $force_pull);
    }
    return $results->size();
  }

But "doSfoQuery" may return "\Drupal\salesforce\SelectQueryResult|null" when "SalesforceQueryEvent" fails, so options are:

  1. Log internal error that makes query event to fail instead of that one if that is intentional
  2. Take that possibility into account & avoid calling to "$results->size()" when that occurs and return FALSE

For now unless the first is justified, the second one will be preferred.

CommentFileSizeAuthor
#2 3458989-2.patch590 bytescrzdev

Comments

CRZDEV created an issue. See original summary.

crzdev’s picture

Status: Active » Needs review
StatusFileSize
new590 bytes

Adding fix, please review and/or comment any suggestion, thanks in advance!

knyshuk.vova’s picture

Status: Needs review » Reviewed & tested by the community

I had the same error. Thanks for the patch. +1 RTBC

  • AaronBauman committed bf2bd6fc on 5.1.x
    Issue #3458989 by CRZDEV: Error: Call to a member function size() on...

  • AaronBauman committed 2ab1cdb0 on 5.0.x
    Issue #3458989 by CRZDEV: Error: Call to a member function size() on...
aaronbauman’s picture

Status: Reviewed & tested by the community » Fixed

Committed, thanks for the patch.

Will be included in 5.1.1 and 5.0.6

crzdev’s picture

Great, thanks!, Please ensure issue credits

Status: Fixed » Closed (fixed)

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