Error from fields with Media Library widget after upgrading to 1.0.12

Created on 6 June 2024, 22 days ago
Updated 26 June 2024, 1 day ago

Problem/Motivation

After upgrading the Acquia DAM module from 1.0.11 to 1.0.12 or 1.0.13 on Drupal 10.2.6, I receive the error below when editing a piece of content with an image field that uses the Media Library widget. This happens when I click the "Add Media" button on a field. Switching to another widget I'm able to edit the image field. I'm also seeing this error whenever I try to clear my site cache.

TypeError: Drupal\acquia_dam\AssetLibraryBuilder::__construct(): Argument #6 ($theme_manager) must be of type Drupal\Core\Theme\ThemeManager, Drupal\Core\Entity\EntityTypeManager given, called in /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\acquia_dam\AssetLibraryBuilder->__construct() (line 129 of /var/www/html/docroot/modules/contrib/acquia_dam/src/AssetLibraryBuilder.php)

#0 /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\acquia_dam\AssetLibraryBuilder->__construct()
#1 /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
#2 /var/www/html/docroot/core/lib/Drupal.php(197): Drupal\Component\DependencyInjection\Container->get()
#3 /var/www/html/docroot/core/modules/media_library/src/Plugin/Field/FieldWidget/MediaLibraryWidget.php(822): Drupal::service()
#4 [internal function]: Drupal\media_library\Plugin\Field\FieldWidget\MediaLibraryWidget::openMediaLibrary()
#5 /var/www/html/docroot/core/lib/Drupal/Core/Form/FormAjaxResponseBuilder.php(69): call_user_func_array()
#6 /var/www/html/docroot/core/lib/Drupal/Core/Form/EventSubscriber/FormAjaxSubscriber.php(112): Drupal\Core\Form\FormAjaxResponseBuilder->buildResponse()
#7 [internal function]: Drupal\Core\Form\EventSubscriber\FormAjaxSubscriber->onException()
#8 /var/www/html/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
#9 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(239): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
#10 /var/www/html/vendor/symfony/http-kernel/HttpKernel.php(91): Symfony\Component\HttpKernel\HttpKernel->handleThrowable()
#11 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/Session.php(58): Symfony\Component\HttpKernel\HttpKernel->handle()
#12 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle()
#13 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#14 /var/www/html/docroot/core/modules/big_pipe/src/StackMiddleware/ContentLength.php(32): Drupal\Core\StackMiddleware\ContentLength->handle()
#15 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Drupal\big_pipe\StackMiddleware\ContentLength->handle()
#16 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#17 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#18 /var/www/html/docroot/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle()
#19 /var/www/html/docroot/core/lib/Drupal/Core/DrupalKernel.php(704): Drupal\Core\StackMiddleware\StackedHttpKernel->handle()
#20 /var/www/html/docroot/index.php(19): Drupal\Core\DrupalKernel->handle()
#21 {main}

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States cYu

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

Merge Requests

Comments & Activities

  • Issue created by @cYu
  • πŸ‡ΊπŸ‡ΈUnited States cYu
  • πŸ‡ΊπŸ‡ΈUnited States cYu
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    It just sounds like the service container needs to be reloaded. its crashing when you run drush cr?

  • πŸ‡ΊπŸ‡ΈUnited States cYu

    Yeah, with drush cr I get:

    Fatal error: Uncaught TypeError: Drupal\acquia_dam\AssetLibraryBuilder::__construct(): Argument #6 ($theme_manager) must be of type Drupal\Core\Theme\ThemeManager, Drupal\Core\Entity\EntityTypeManager given, called in /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and defined in /var/www/html/docroot/modules/contrib/acquia_dam/src/AssetLibraryBuilder.php:129
    Stack trace:
    #0 /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(259): Drupal\acquia_dam\AssetLibraryBuilder->__construct()
    #1 /var/www/html/docroot/core/lib/Drupal/Component/DependencyInjection/Container.php(177): Drupal\Component\DependencyInjection\Container->createService()
    #2 /var/www/html/docroot/core/lib/Drupal/Core/DependencyInjection/ClassResolver.php(20): Drupal\Component\DependencyInjection\Container->get()
    #3 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityResolverManager.php(106): Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition()
    #4 /var/www/html/docroot/core/lib/Drupal/Core/Entity/EntityResolverManager.php(219): Drupal\Core\Entity\EntityResolverManager->getControllerClass()
    #5 /var/www/html/docroot/core/lib/Drupal/Core/EventSubscriber/EntityRouteAlterSubscriber.php(48): Drupal\Core\Entity\EntityResolverManager->setRouteOptions()
    #6 [internal function]: Drupal\Core\EventSubscriber\EntityRouteAlterSubscriber->onRoutingRouteAlterSetType()
    #7 /var/www/html/docroot/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func()
    #8 /var/www/html/docroot/core/lib/Drupal/Core/Routing/RouteBuilder.php(189): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch()
    #9 /var/www/html/docroot/core/lib/Drupal/Core/ProxyClass/Routing/RouteBuilder.php(83): Drupal\Core\Routing\RouteBuilder->rebuild()
    #10 /var/www/html/docroot/core/includes/common.inc(485): Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild()
    #11 /var/www/html/docroot/core/includes/utility.inc(41): drupal_flush_all_caches()
    #12 /var/www/html/vendor/drush/drush/src/Commands/core/CacheRebuildCommands.php(66): drupal_rebuild()
    #13 [internal function]: Drush\Commands\core\CacheRebuildCommands->rebuild()
    #14 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array()
    #15 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback()
    #16 /var/www/html/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter()
    #17 /var/www/html/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process()
    #18 /var/www/html/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute()
    #19 /var/www/html/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run()
    #20 /var/www/html/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand()
    #21 /var/www/html/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun()
    #22 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run()
    #23 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
    #24 /var/www/html/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run()
    #25 /var/www/html/vendor/drush/drush/drush(4): require('...')
    #26 /var/www/html/vendor/bin/drush(119): include('...')
    #27 {main}
      thrown in /var/www/html/docroot/modules/contrib/acquia_dam/src/AssetLibraryBuilder.php on line 129
     [warning] Drush command terminated abnormally.
  • Pipeline finished with Success
    21 days ago
    Total: 1256s
    #193905
  • Pipeline finished with Success
    21 days ago
    #193906
  • Status changed to Fixed 21 days ago
  • πŸ‡ΊπŸ‡ΈUnited States japerry KVUO

    Spent a little time on this today. While I could not reproduce the issue, there isn't really a reason to be injecting these services other than phpstan. Therefore I reverted the change and pushed to head in 1.0.x and 1.1

  • Pipeline finished with Skipped
    21 days ago
    #193928
    • japerry β†’ committed 2f6e92f0 on 1.0.x
      Issue #3453029: Error from fields with Media Library widget after...
    • japerry β†’ committed 2b6c2885 on 1.1.x
      Issue #3453029: Error from fields with Media Library widget after...
  • πŸ‡ΊπŸ‡ΈUnited States cYu

    Thank you for taking a look. I've patched our 1.0.11 version with the recent security fix and will test out a switch over to 1.0.x-dev (or 1.0.14 if it lands) in our next deploy cycle.

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

Production build 0.69.0 2024