Unexpected error upon cron run

Created on 15 April 2023, over 1 year ago
Updated 28 April 2024, 8 months ago

Problem/Motivation

When cron runs, it produces an error and the notifications aren't sent.

This only happens when there are subscribers to be notified.

Steps to reproduce

  1. Install and enable the module
  2. Subscribe a couple of users to a product that's out of stock.
  3. Run the Drupal cron; whether using the GUI or Drush.

You will see the following error:

The website encountered an unexpected error. Please try again later.
Error: Call to a member function getPreferredLangcode() on bool in Drupal\commerce_stock_notifications\Plugin\QueueWorker\CommerceStockNotifyQueue->processItem() (line 114 of modules/contrib/commerce_stock_notifications/src/Plugin/QueueWorker/CommerceStockNotifyQueue.php).
Drupal\commerce_stock_notifications\Plugin\QueueWorker\CommerceStockNotifyQueue->processItem(Object) (Line: 183)
Drupal\Core\Cron->processQueues() (Line: 139)
Drupal\Core\Cron->run() (Line: 75)
Drupal\Core\ProxyClass\Cron->run() (Line: 59)
Drupal\system\CronController->runManually()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 580)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 169)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
πŸ› Bug report
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States jcmartinez Raleigh, NC, USA

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

Comments & Activities

Production build 0.71.5 2024