Calling validatePackageManager on NULL in line 134 of \Drupal\project_browser\Element\ProjectBrowser

Created on 25 November 2024, 27 days ago

Problem/Motivation

I get this exception:

Error: Call to a member function validatePackageManager() on null in Drupal\project_browser\Element\ProjectBrowser->getDrupalSettings() (line 134 of modules/contrib/project_browser/src/Element/ProjectBrowser.php).

Drupal\project_browser\Element\ProjectBrowser->attachProjectBrowserSettings(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: 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: 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: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle(Object, 1, 1) (Line: 50)
Drupal\ban\BanMiddleware->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)

This happens because the create function of that class calls

$container->get(InstallReadiness::class, ContainerInterface::NULL_ON_INVALID_REFERENCE),

which return NULL.

Proposed resolution

Unfortunately, I don't know why this isn't working. I'm on Drupal 10.4.x-dev

🐛 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

    This seems to happen because package_manager in not available. The class \Drupal\project_browser\InstallReadiness uses a trait from package manager but that doesn't exist for Drupal 10. Or am I missing something?

  • 🇺🇸United States chrisfromredfin Portland, Maine

    Package Manager for Drupal 10, prior to it being in core, needs to come with Automatic Updates (in particular, a version of AU which still bundled PM).

  • 🇮🇪Ireland lostcarpark

    As far as I can tell, Package Manager is still in all branches of Automatic Updates 3.x. Adding the Automatic Updates project with Composer, and enabling the Automatic Updates module should enable installing in Project Browser.

    I presume there will be a version of Automatic Updates that removes Package Manager, but that doesn't seem to exist yet.

Production build 0.71.5 2024