Update group_content_menu_update_9301 fails with message "Class name must be a valid object or a string"

Created on 29 October 2024, 26 days ago

Problem/Motivation

I'm working on a project using Drupal 10.3.6 with the Group and Group Content Menu modules, both on version 3.0.x-dev. During monthly maintenance, I attempted to update the Group Content Menu module, advancing from commit #58d7f659 to #4e1c8e55. The initial update went smoothly, but issues arose when running database updates post-composer update. Specifically, the database update group_content_menu_update_9301 — introduced as part of issue #3478732 — failed, showing the error: "Class name must be a valid object or a string." Suspecting my applied patches for the Group Content Menu module might be causing the issue, I removed them, yet the error persists even without the patches. Right now my solution to the issue is to lock the module at the #58d7f659 commit.

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇫🇮Finland Alexander Tallqvist

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

Comments & Activities

  • Issue created by @Alexander Tallqvist
  • heddn Nicaragua

    Can we get the error as logged in the drupal logs too? The output from drush doesn't provide enough details to investigate this.

  • 🇫🇮Finland Alexander Tallqvist

    Unfortunately nothing gets logged into Drupals logs. The only thing I'm getting is this in my terminal:

    Module Update ID Type Description
    -------------------- ------------------------- --------------- -------------------------------------------------------
    group_content_menu 9301 hook_update_n 9301 - Update group content menus to be publisheable.
    group_content_menu convert_to_revisionable post-update Update group content menus to be revisionable.
    -------------------- ------------------------- --------------- -------------------------------------------------------

    // Do you wish to run the specified pending updates?: yes.

    > [notice] Update started: group_content_menu_update_9301
    > [error] Class name must be a valid object or a string
    > [error] Update failed: group_content_menu_update_9301
    [error] Update aborted by: group_content_menu_update_9301
    [error] Finished performing updates.

  • heddn Nicaragua

    Can you xdebug or anything in the update to see what is happening?

  • 🇫🇮Finland Alexander Tallqvist

    @heddn I'll get back to you at the end of the month when doing updates again.

  • 🇫🇮Finland Alexander Tallqvist

    Hi again! I used drush php:eval "module_load_include('install', 'group_content_menu');group_content_menu_update_9301();" for debugging and was able to produce this:

    Error: Class name must be a valid object or a string in /app/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php on line 283 #0 /app/web/core/lib/Drupal/Core/Entity/EntityTypeListener.php(112): Drupal\Core\Entity\EntityTypeManager->createHandlerInstance(NULL, Object(Drupal\Core\Entity\ContentEntityType))
    #1 /app/web/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php(159): Drupal\Core\Entity\EntityTypeListener->onEntityTypeUpdate(Object(Drupal\Core\Entity\ContentEntityType), Object(Drupal\Core\Entity\ContentEntityType))
    #2 /app/web/modules/contrib/group_content_menu/group_content_menu.install(24): Drupal\Core\Entity\EntityDefinitionUpdateManager->updateEntityType(Object(Drupal\Core\Entity\ContentEntityType))
    #3 /app/vendor/drush/drush/src/Commands/core/PhpCommands.php(32) : eval()'d code(1): group_content_menu_update_9301()
    #4 /app/vendor/drush/drush/src/Commands/core/PhpCommands.php(32): eval()
    #5 [internal function]: Drush\Commands\core\PhpCommands->evaluate('module_load_inc...', Array)
    #6 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
    #7 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
    #8 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    #9 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
    #10 /app/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #11 /app/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #12 /app/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))
    #13 /app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
    #14 /app/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))
    #15 /app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
    #16 /app/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
    #17 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
    #18 /app/vendor/bin/drush(119): include('/app/vendor/dru...')
    #19 {main}
    Error: Class name must be a valid object or a string in Drupal\Core\Entity\EntityTypeManager->createHandlerInstance() (line 283 of /app/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php).
     [warning] Drush command terminated abnormally.
  • 🇫🇮Finland Alexander Tallqvist

    Did some more digging and noticed that createHandlerInstance() in EntityTypeManager.php gets passed in a $class variable with the value of "Drupal\group_content_menu\GroupContentMenuStorage", which doesn't seem to exist? If I call $entity_type->setStorageClass(SqlContentEntityStorage::class); in group_content_menu_update_9301() before $definition_update_manager->updateEntityType($entity_type); gets called, then everything seems to work fine and the update goes through?

Production build 0.71.5 2024