Exception when deleting a user in Drupal site

Created on 27 April 2024, 9 months ago

Problem/Motivation

When deleting a user, e.g. at the end of our Cypress tests, and when the helpdesk user sync is enabled, we get this exception:

TypeError: Drupal\helpdesk_integration\PluginBase::getUserPreCreationEvent(): Argument #2 ($user) must be of type Drupal\user\UserInterface, null given, called in /var/www/html/web/modules/contrib/helpdesk_integration/src/PluginBase.php on line 560 in Drupal\helpdesk_integration\PluginBase::getUserPreCreationEvent() (line 606 of /var/www/html/web/modules/contrib/helpdesk_integration/src/PluginBase.php)

#0 /var/www/html/web/modules/contrib/helpdesk_integration/src/PluginBase.php(560): Drupal\helpdesk_integration\PluginBase::getUserPreCreationEvent()
#1 /var/www/html/web/modules/contrib/helpdesk_integration/src/Service.php(307): Drupal\helpdesk_integration\PluginBase->updateAllUsers()
#2 /var/www/html/web/modules/contrib/helpdesk_integration/src/Service.php(344): Drupal\helpdesk_integration\Service->updateAll()
#3 /var/www/html/web/modules/contrib/helpdesk_integration/helpdesk_integration.module(114): Drupal\helpdesk_integration\Service->sync()
#4 /var/www/html/web/modules/contrib/helpdesk_integration/helpdesk_integration.module(151): helpdesk_integration_entity_insert()
#5 [internal function]: helpdesk_integration_entity_delete()
#6 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(417): call_user_func_array()
#7 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(396): Drupal\Core\Extension\ModuleHandler->Drupal\Core\Extension\{closure}()
#8 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(416): Drupal\Core\Extension\ModuleHandler->invokeAllWith()
#9 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(217): Drupal\Core\Extension\ModuleHandler->invokeAll()
#10 /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(900): Drupal\Core\Entity\EntityStorageBase->invokeHook()
#11 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(462): Drupal\Core\Entity\ContentEntityStorageBase->invokeHook()
#12 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(753): Drupal\Core\Entity\EntityStorageBase->delete()
#13 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php(362): Drupal\Core\Entity\Sql\SqlContentEntityStorage->delete()
#14 /var/www/html/web/core/modules/user/user.module(691): Drupal\Core\Entity\EntityBase->delete()
#15 /var/www/html/vendor/drush/drush/includes/batch.inc(257): _user_cancel()
#16 /var/www/html/vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()
#17 /var/www/html/vendor/drush/drush/includes/batch.inc(75): _drush_batch_command()
#18 /var/www/html/vendor/drush/drush/src/Commands/core/BatchCommands.php(25): drush_batch_command()
#19 [internal function]: Drush\Commands\core\BatchCommands->process()
#20 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
#21 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
#22 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
#23 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process()
#24 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
#25 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
#26 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
#27 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
#28 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
#29 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#30 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
#31 /var/www/html/vendor/drush/drush/drush(4): require('...')
#32 /var/www/html/vendor/bin/drush(119): include('...')
#33 {main}

This is related to 📌 Delete users Active and the proper solution should be implemented there.

Remaining tasks

As a workaround, let's disable the hook that tries to sync the deleted user.

🐛 Bug report
Status

Active

Version

2.0

Component

Code

Created by

🇩🇪Germany jurgenhaas Gottmadingen

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

Comments & Activities

Production build 0.71.5 2024