EmbeddingQueueWorker->processItem() errors

Created on 27 February 2023, almost 2 years ago
Updated 2 March 2023, almost 2 years ago

On my test site running the Drupal 10 and latest DEV version of OpenAI, I am regularly seeing errors logged like this shortly after CRON runs:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function get() on null in Drupal\openai_embeddings\Plugin\QueueWorker\EmbeddingQueueWorker->processItem() (line 124 of modules/contrib/openai/modules/openai_embeddings/src/Plugin/QueueWorker/EmbeddingQueueWorker.php).
Drupal\openai_embeddings\Plugin\QueueWorker\EmbeddingQueueWorker->processItem() (Line: 183)

Noticed this @TODO on Line 115:
// @todo Wrap this in a try catch

Browser Console Errors are logged, and breaks all other AJAX functionality of the site, such as Views Infinite Scroll in my case:

Uncaught 
Drupal.AjaxError
message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 200\nDebugging information follows.\nPath: /views/ajax\nStatusText: OK\nResponseText: 
name: "AjaxError"

Added this new block of code to check that $entity exists first at line 122, which isn't 'clean' but seemingly works around the above issue thus far:

    if (!isset($entity)) {
        return;
    }
πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States d0t101101

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

Comments & Activities

Production build 0.71.5 2024