Agreement Handler:construct(): Argument #2 ($settings) must be of type Drupal\Core\Site\Settings

Created on 13 February 2024, 5 months ago
Updated 4 April 2024, 3 months ago

Problem/Motivation

Drupal 9.5.11, PHP 8.1
After composer update --with-all-dependencies: Upgrading drupal/agreement (3.0.0-alpha2 => 3.0.0-alpha3)
Site shows error:
The website encountered an unexpected error. Please try again later.
TypeError: Drupal\agreement\AgreementHandler::__construct(): Argument #2 ($settings) must be of type Drupal\Core\Site\Settings, Drupal\Core\Entity\EntityTypeManager given, called in /www/htdocs/YYYYYYY/xxxxx.com/htdocs/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\agreement\AgreementHandler->__construct() (line 86 of modules/contrib/agreement/src/AgreementHandler.php).

Drupal\agreement\AgreementHandler->__construct(Object, Object, Object, Object, Object) (Line: 259)
Drupal\Component\DependencyInjection\Container->createService(Array, 'agreement.handler') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('agreement.handler', 1) (Line: 434)
Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 237)
Drupal\Component\DependencyInjection\Container->createService(Array, 'agreement_subscriber') (Line: 177)
Drupal\Component\DependencyInjection\Container->get('agreement_subscriber') (Line: 136)
Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.request') (Line: 145)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 81)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 44)
Drupal\redirect_after_login\RedirectMiddleware->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 191)
Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 128)
Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 82)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 57)
Drupal\advban\AdvbanMiddleware->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: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

Steps to reproduce

Upgrade cli PHP 7 to 8.1.
composer update --with-all-dependencies

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

💬 Support request
Status

Postponed: needs info

Version

3.0

Component

Miscellaneous

Created by

🇪🇸Spain lapurddrupal

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

Comments & Activities

  • Issue created by @lapurddrupal
  • Assigned to abhishek_virasat
  • Issue was unassigned.
  • Status changed to Needs review 5 months ago
  • 🇺🇸United States mradcliffe USA

    You should rebuild the cache after updating this release or after deploying any module updates for a Drupal site.

    I did assume use of drush or a CI system, but if a site builder only user does not have drush, then getting to the performance page could be problematic. I think if you visit /core/rebuild.php that should also clear the cache if settings.php is configured to allow it with $settings['rebuild_access'] = TRUE;.

    I'll update the release notes.

  • 🇪🇸Spain lapurddrupal

    #mradcliff
    Thank you for the comment. If I have understood correctly, then the page can be restored running rebuild.php with settings rebuild_acess = true?
    I gave up using Drush because in the past there was often a chicken-egg problem with different versions of Composer and Drush which could not be solved in a reasonable time.

  • 🇺🇸United States mradcliffe USA

    Yes, that should allow you to recover, @lapurddrupal. It's a relatively new concept in the user guide, but it is here if you need to share this with someone else: 12.2 Clearing the cache: using the rebuild script →

  • 🇪🇸Spain lapurddrupal

    I did it as suggested. Unfortunately I got the same error, even calling '.../core/rebuild.php' was unsuccessful.
    Error message: ypeError: Drupal\agreement\AgreementHandler::__construct(): Argument #2 ($settings) must be of type Drupal\Core\Site\Settings, Drupal\Core\Entity\EntityTypeManager given, called in /www/htdocs/YYYYY/xxxxxx.com/htdocs/drupal/web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 in Drupal\agreement\AgreementHandler->__construct() (line 86 of modules/contrib/agreement/src/AgreementHandler.php).

    Drupal\agreement\AgreementHandler->__construct(Object, Object, Object, Object, Object) (Line: 259)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'agreement.handler') (Line: 177)
    Drupal\Component\DependencyInjection\Container->get('agreement.handler', 1) (Line: 434)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters(Array) (Line: 237)
    Drupal\Component\DependencyInjection\Container->createService(Array, 'agreement_subscriber') (Line: 177)
    Drupal\Component\DependencyInjection\Container->get('agreement_subscriber') (Line: 136)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch(Object, 'kernel.exception') (Line: 229)
    Symfony\Component\HttpKernel\HttpKernel->handleThrowable(Object, Object, 1) (Line: 92)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 44)
    Drupal\redirect_after_login\RedirectMiddleware->handle(Object, 1, 1) (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 191)
    Drupal\page_cache\StackMiddleware\PageCache->fetch(Object, 1, 1) (Line: 128)
    Drupal\page_cache\StackMiddleware\PageCache->lookup(Object, 1, 1) (Line: 82)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 57)
    Drupal\advban\AdvbanMiddleware->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: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 718)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

  • 🇺🇸United States mradcliffe USA

    Hmm, I'm sorry that's happening. I tried to installing the module on 9.5.11 via DrupalPod, and things are working okay.

    Are you sure there are no other code differences on your site for agreement?

    Also, are you using a separate caching mechanism on the site like Memcached or Redis? If you're using one of those, then maybe the rebuild.php option won't work (anymore?), and there is a separate tool for clearing that cache manually?

  • Status changed to Postponed: needs info 3 months ago
  • 🇺🇸United States mradcliffe USA
Production build 0.69.0 2024