User sync fails

Created on 6 February 2025, 17 days ago

Problem/Motivation

 [error]  Pushing users to LakeDrops GitLab failed: Gitlab\Exception\RuntimeException: Username has already been taken in /var/www/html/vendor/m4tthumphrey/php-gitlab-api/src/HttpClient/Plugin/ExceptionThrower.php:78
Stack trace:
#0 /var/www/html/vendor/m4tthumphrey/php-gitlab-api/src/HttpClient/Plugin/ExceptionThrower.php(53): Gitlab\HttpClient\Plugin\ExceptionThrower::createException(409, 'Username has al...')
#1 /var/www/html/vendor/php-http/httplug/src/Promise/HttpFulfilledPromise.php(28): Gitlab\HttpClient\Plugin\ExceptionThrower->Gitlab\HttpClient\Plugin\{closure}(Object(GuzzleHttp\Psr7\Response))
#2 /var/www/html/vendor/m4tthumphrey/php-gitlab-api/src/HttpClient/Plugin/ExceptionThrower.php(49): Http\Client\Promise\HttpFulfilledPromise->then(Object(Closure))
#3 /var/www/html/vendor/php-http/client-common/src/PluginChain.php(44): Gitlab\HttpClient\Plugin\ExceptionThrower->handleRequest(Object(GuzzleHttp\Psr7\Request), Object(Closure), Object(Http\Client\Common\PluginChain))
#4 /var/www/html/vendor/php-http/client-common/src/PluginChain.php(59): Http\Client\Common\PluginChain->Http\Client\Common\{closure}(Object(GuzzleHttp\Psr7\Request))
#5 /var/www/html/vendor/php-http/client-common/src/PluginClient.php(84): Http\Client\Common\PluginChain->__invoke(Object(GuzzleHttp\Psr7\Request))
#6 /var/www/html/vendor/php-http/client-common/src/HttpMethodsClient.php(148): Http\Client\Common\PluginClient->sendRequest(Object(GuzzleHttp\Psr7\Request))
#7 /var/www/html/vendor/php-http/client-common/src/HttpMethodsClient.php(107): Http\Client\Common\HttpMethodsClient->sendRequest(Object(GuzzleHttp\Psr7\Request))
#8 /var/www/html/vendor/php-http/client-common/src/HttpMethodsClient.php(70): Http\Client\Common\HttpMethodsClient->send('POST', '/api/v4/users?', Array, '{"name":"lena",...')
#9 /var/www/html/vendor/m4tthumphrey/php-gitlab-api/src/Api/AbstractApi.php(134): Http\Client\Common\HttpMethodsClient->post('/api/v4/users?', Array, '{"name":"lena",...')
#10 /var/www/html/vendor/m4tthumphrey/php-gitlab-api/src/Api/Users.php(279): Gitlab\Api\AbstractApi->post('users', Array)
#11 /var/www/html/web/modules/contrib/helpdesk_gitlab/src/Plugin/HelpdeskIntegration/GitLab.php(267): Gitlab\Api\Users->create('lenahaas522@gma...', 'abc', Array)
#12 /var/www/html/web/modules/contrib/helpdesk_integration/src/PluginBase.php(586): Drupal\helpdesk_gitlab\Plugin\HelpdeskIntegration\GitLab->pushUser(Object(Drupal\helpdesk_integration\Entity\Helpdesk), Object(Drupal\user\Entity\User))
#13 /var/www/html/web/modules/contrib/helpdesk_integration/src/Service.php(362): Drupal\helpdesk_integration\PluginBase->updateAllUsers(Object(Drupal\helpdesk_integration\Entity\Helpdesk), NULL, NULL)
#14 /var/www/html/web/modules/contrib/helpdesk_integration/src/Service.php(399): Drupal\helpdesk_integration\Service->updateAll('users', Object(Drupal\helpdesk_integration\Entity\Helpdesk), NULL, false, NULL)
#15 /var/www/html/web/modules/contrib/helpdesk_integration/src/Drush/Commands/SyncCommands.php(78): Drupal\helpdesk_integration\Service->sync('users')
#16 [internal function]: Drupal\helpdesk_integration\Drush\Commands\SyncCommands->syncUsers(Array)
#17 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
#18 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#19 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#20 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#21 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run(Array)
#28 /var/www/html/vendor/bin/drush.php(119): include('/var/www/html/v...')
#29 {main} 
🐛 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

  • Issue created by @jurgenhaas
  • 🇩🇪Germany jurgenhaas Gottmadingen

    The problem is caused by a user that has changed their email address in Drupal. If the remote IDs are lost (happened here because of a site rebuild) then the remote user can not be found with the new email. The sync process wants to create a new use remotely, but that fails because a user with the user name already exists.

    This is an edge case, but we could catch such exceptions and re-try with a random user-name. That would then also solve the problem at 🐛 User names may be a problem for certain backends Active . So I'm closing this one in favour of the other one.

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

Production build 0.71.5 2024