Adding media throws exception after Drupal 10.3 upgrade

Created on 9 July 2024, 4 months ago
Updated 20 August 2024, 3 months ago

Problem/Motivation

Adding media throws exception after upgrading to Drupal 10.3

Steps to reproduce

  1. Install or Upgrade to Drupal 10.3
  2. Install and configure the module
  3. Click on insert media button

Expected

The media library modal should open to select and insert DAM assets

Experienced exception

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /media-library?media_library_opener_id=media_library.opener.editor&media_library_allowed_types%5Bacquia_dam_documents_asset%5D=acquia_dam_documents_asset&media_library_allowed_types%5Bacquia_dam_image_asset%5D=acquia_dam_image_asset&media_library_allowed_types%5Bacquia_dam_pdf_asset%5D=acquia_dam_pdf_asset&media_library_allowed_types%5Bremote_video%5D=remote_video&media_library_selected_type=acquia_dam_documents_asset&media_library_remaining=1&media_library_opener_parameters%5Bfilter_format_id%5D=full_html&hash=uCiw87EQDs3F0PG2XTYy9p3twViaCHaVh9yiiU3kbBw
StatusText: error
ResponseText: The website encountered an unexpected error. Try again later.

TypeError: Drupal\media_library\Plugin\views\field\MediaLibrarySelectForm::form_element_row_id(): Return value must be of type string, null returned in Drupal\media_library\Plugin\views\field\MediaLibrarySelectForm->form_element_row_id() (line 58 of core/modules/media_library/src/Plugin/views/field/MediaLibrarySelectForm.php). Drupal\views\Form\ViewsFormMainForm->buildForm(Array, Object, Object, Array) (Line: 172)
Drupal\views\Form\ViewsForm->buildForm(Array, Object, Object, Array)
call_user_func_array(Array, Array) (Line: 536)
Drupal\Core\Form\FormBuilder->retrieveForm('views_form_acquia_dam_asset_library_widget_acquia_dam_documents_asset', Object) (Line: 284)
Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 224)
Drupal\Core\Form\FormBuilder->getForm(Object, Object, Array) (Line: 2265)
Drupal\views\Plugin\views\display\DisplayPluginBase->elementPreRender(Array)
call_user_func_array(Array, Array) (Line: 113)
Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725' , 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
Drupal\Core\Render\Renderer->render(Array) (Line: 475)
Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 49)
__TwigTemplate_5935cafd06e3a5f0427a2467d5ff43c0->doDisplay(Array, Array) (Line: 360)
Twig\Template->yield(Array) (Line: 335)
Twig\Template->render(Array) (Line: 38)
Twig\TemplateWrapper->render(Array) (Line: 33)
twig_render_template('core/themes/claro/templates/classy/media-library/media-library-wrapper.html.twig', Array) (Line: 348)
Drupal\Core\Theme\ThemeManager->render('media_library_wrapper', Array) (Line: 491)
Drupal\Core\Render\Renderer->doRender(Array, 1) (Line: 248)
Drupal\Core\Render\Renderer->render(Array, 1) (Line: 153)
Drupal\Core\Render\Renderer->Drupal\Core\Render\{closure}() (Line: 638)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 152)
Drupal\Core\Render\Renderer->renderRoot(Array) (Line: 22)
Drupal\Core\Render\MainContent\ModalRenderer->renderResponse(Array, Object, Object) (Line: 90)
Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 54)
Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 53)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 53)
Asm89\Stack\Cors->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\
egotiationMiddleware->handle(Object, 1, 1) (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

🐛 Bug report
Status

Fixed

Version

1.0

Component

Code

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

Merge Requests

Comments & Activities

  • Issue created by @meetarijeet@gmail.com
  • 🇺🇸United States themodularlab

    I am also seeing this error after upgrading to Drupal 10.3.

  • First commit to issue fork.
  • Merge request !60#3460172 – Fix missing mid key → (Closed) created by deepakkm
  • Pipeline finished with Failed
    4 months ago
    Total: 1179s
    #224784
  • Pipeline finished with Failed
    4 months ago
    Total: 1640s
    #224789
  • Status changed to Closed: duplicate 4 months ago
  • 🇮🇳India deepakkm

    This issue has already been fixed here and its merged too - https://www.drupal.org/project/acquia_dam/issues/3442662 🐛 Incompatible with Drupal 10.3 and higher Fixed
    may be a new release is needed.

  • Status changed to Needs review 4 months ago
  • Pipeline finished with Failed
    4 months ago
    Total: 1045s
    #226217
  • Pipeline finished with Success
    4 months ago
    Total: 984s
    #226218
  • Pipeline finished with Failed
    4 months ago
    Total: 1553s
    #226215
  • Pipeline finished with Success
    4 months ago
    Total: 1024s
    #226225
  • 🇬🇧United Kingdom jalpesh

    facing same issue. created patch if someone wanted to apply before new release.

  • Status changed to RTBC 4 months ago
  • 🇮🇳India patelmayank7552

    Hi @jalpesh

    This patch has fixed the issue. As I am using acquia_dam module for one of the project and after applying your patch I am able to add media when I enabled the acquia_dam and its configuration for the media type in my paragraph type and content type.

    Thanks for working around on this.

  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺
  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺
  • Status changed to Fixed 3 months ago
  • 🇺🇸United States japerry KVUO
  • 🇭🇺Hungary Balu Ertl Budapest 🇪🇺

    Suggested changes with a slightly modified syntax were committed into the default branch 1.0.x in commit ef48343e.

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

  • 🇮🇳India bmahesh03121

    still facing this error

    Drupal 10.3.3

    acquia_dam dev-1.1.x

    while clicking on insert selected I am getting below error

    "
    An AJAX HTTP error occurred.
    HTTP Result Code: 500
    Debugging information follows.
    Path: /media-library?destination=/admin/content&ajax_form=1&_wrapper_format=drupal_ajax&complete_allowed_list%5B0%5D=acquia_dam_image_asset&complete_allowed_list%5B1%5D=image&media_library_opener_id=media_library.opener.field_widget&media_library_allowed_types%5B0%5D=image&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfield_widget_id%5D=field_media&media_library_opener_parameters%5Bentity_type_id%5D=node&media_library_opener_parameters%5Bbundle%5D=article&media_library_opener_parameters%5Bfield_name%5D=field_media&media_library_opener_parameters%5Bentity_id%5D=617501&media_library_opener_parameters%5Brevision_id%5D=1016592&hash=7MlUA2CT-96dB2Qd5iwPcfbIHwiZrWh9x_TphSzvWq4&source=core&views_display_id=widget
    StatusText: Internal Server Error
    ResponseText: The website encountered an unexpected error. Try again later.Error: Call to a member function getColumns() on bool in Drupal\Core\Entity\Query\Sql\Tables->addField() (line 246 of core/lib/Drupal/Core/Entity/Query/Sql/Tables.php). Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 53)
    Drupal\Core\Entity\Query\Sql\Condition->compile(Object) (Line: 177)
    Drupal\Core\Entity\Query\Sql\Query->compile() (Line: 82)
    Drupal\Core\Entity\Query\Sql\Query->execute() (Line: 147)
    Drupal\acquia_dam\AssetRepository->find(Array) (Line: 111)
    Drupal\acquia_dam\Plugin\views\field\MediaLibrarySelectForm->processInputValues(Array, Object)
    call_user_func_array(Array, Array) (Line: 129)
    Drupal\Core\Form\FormSubmitter->executeSubmitHandlers(Array, Object) (Line: 67)
    Drupal\Core\Form\FormSubmitter->doSubmitForm(Array, Object) (Line: 597)
    Drupal\Core\Form\FormBuilder->processForm('views_form_media_library_widget_image', Array, Object) (Line: 326)
    Drupal\Core\Form\FormBuilder->buildForm(Object, Object) (Line: 224)
    Drupal\Core\Form\FormBuilder->getForm(Object, Object, Array) (Line: 2265)
    Drupal\views\Plugin\views\display\DisplayPluginBase->elementPreRender(Array)
    call_user_func_array(Array, Array) (Line: 113)
    Drupal\Core\Render\Renderer->doTrustedCallback(Array, Array, 'Render #pre_render callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725' , 'exception', 'Drupal\Core\Render\Element\RenderCallbackInterface') (Line: 870)
    Drupal\Core\Render\Renderer->doCallback('#pre_render', Array, Array) (Line: 432)
    Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
    Drupal\Core\Render\Renderer->doRender(Array) (Line: 504)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
    Drupal\Core\Render\Renderer->render(Array) (Line: 475)
    Drupal\Core\Template\TwigExtension->escapeFilter(Object, Array, 'html', NULL, 1) (Line: 49)
    __TwigTemplate_1235ad64ad236fd727f341745b070f97->doDisplay(Array, Array) (Line: 360)
    Twig\Template->yield(Array) (Line: 335)
    Twig\Template->render(Array) (Line: 38)
    Twig\TemplateWrapper->render(Array) (Line: 33)
    twig_render_template('themes/contrib/seven/templates/classy/media-library/media-library-wrapper.html.twig', Array) (Line: 348)
    Drupal\Core\Theme\ThemeManager->render('media_library_wrapper', Array) (Line: 491)
    Drupal\Core\Render\Renderer->doRender(Array, ) (Line: 248)
    Drupal\Core\Render\Renderer->render(Array, ) (Line: 238)
    Drupal\Core\Render\MainContent\HtmlRenderer->Drupal\Core\Render\MainContent\{closure}() (Line: 638)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 231)
    Drupal\Core\Render\MainContent\HtmlRenderer->prepare(Array, Object, Object) (Line: 128)
    Drupal\Core\Render\MainContent\HtmlRenderer->renderResponse(Array, Object, Object) (Line: 90)
    Drupal\Core\EventSubscriber\MainContentViewSubscriber->onViewRenderArray(Object, 'kernel.view', Object)
    call_user_func(Array, Object, 'kernel.view', Object) (Line: 111)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.view') (Line: 186)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 76)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 68)
    Drupal\simple_oauth\HttpMiddleware\BasicAuthSwap->handle(Object, 1, 1) (Line: 53)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->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: 270)
    Drupal\shield\ShieldMiddleware->bypass(Object, 1, 1) (Line: 137)
    Drupal\shield\ShieldMiddleware->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: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle(Object, 1, 1) (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object, 1, 1) (Line: 741)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
    "

Production build 0.71.5 2024