Assistance on upgrading from beta6 to beta7

Created on 28 February 2024, 4 months ago
Updated 3 March 2024, 4 months ago

Drupal 10.2.3
I tried to update fron beta6 to beta7

First attempt:
composer update drupal/access_policy --with-all-dependencies
No change: beta6 remains

Second attempt:
composer require drupal/access_policy:1.0.0-beta7
Error when I open the site

The website encountered an unexpected error. Try again later.
ArgumentCountError: Too few arguments to function Drupal\access_policy\AccessPolicyValidator::__construct(), 3 passed in /home/../mysitefolder/core/lib/Drupal/Component/DependencyInjection/Container.php on line 259 and exactly 4 expected in Drupal\access_policy\AccessPolicyValidator->__construct() (line 75 of modules/contrib/access_policy/src/AccessPolicyValidator.php).

Is there a bug or did I update in a wrong way? (I did the same way with another module and it worked)

πŸ› Bug report
Status

Closed: works as designed

Version

1.0

Component

Miscellaneous

Created by

πŸ‡«πŸ‡·France gilbertdelyon

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

Comments & Activities

  • Issue created by @gilbertdelyon
  • πŸ‡ΊπŸ‡ΈUnited States partdigital

    Hi gilbertdelyon, did you clear the cache?

  • πŸ‡«πŸ‡·France gilbertdelyon

    This is what I did:
    In a Production site (D10.2.3)
    - In admin >config > performance > clear the cache
    console:
    composer update drupal/access_policy
    back to the site admin
    Clear the cache again
    Admin > extensions
    Access_policy Beta6 is still there (with your last patch!)

    In a test site on same server (D10.2.2 with only a few modules - nearly empty site))
    Same process
    composer update drupal/access_policy
    After update I go back to site and get this error

    The website encountered an unexpected error. Try again later.
    Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException: Circular reference detected for service "access_policy.validator", path: "access_policy.validator -> exception.access_policy_html". in Drupal\Component\DependencyInjection\Container->get() (line 147 of core/lib/Drupal/Component/DependencyInjection/Container.php).
    Drupal\Component\DependencyInjection\Container->get() (Line: 440)
    Drupal\Component\DependencyInjection\Container->resolveServicesAndParameters() (Line: 237)
    Drupal\Component\DependencyInjection\Container->createService() (Line: 177)
    Drupal\Component\DependencyInjection\Container->get() (Line: 105)
    Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch() (Line: 239)
    Symfony\Component\HttpKernel\HttpKernel->handleThrowable() (Line: 91)
    Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 58)
    Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
    Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
    Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
    Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
    Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 704)
    Drupal\Core\DrupalKernel->handle() (Line: 19)

    Back to console
    Downgrade to beta6. It works

  • πŸ‡«πŸ‡·France gilbertdelyon

    Notice: same process for other modules updating. No issue.

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

    Would you mind sharing any access policies that you have?

  • πŸ‡«πŸ‡·France gilbertdelyon

    See attached document
    (I have only one policy)
    gfamily_access_policy_config_240229.txt

  • πŸ‡«πŸ‡·France gilbertdelyon

    Notice:
    Previous post was for Production site 'D10.2.3)

    In Test site (D10.2) Access_Policy is installed but not configured (no policy)

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

    Thank you.

    Unfortunately I still can't reproduce it.

    It's a very odd error because nothing changed in regards to the 403 http response. It sounds like it may be another issue with a mysterious cause unique to your environment (similar to #3419046 πŸ› Undefined context error when user resets password Fixed ). Perhaps it's conflicting with a contrib module? Are you able to reproduce the error on a vanilla Drupal 10 site?

  • Hello,
    As per understanding from version 1.0.6 to 1.0.7
    We can see that now services have new parameters introduced.

    In version 1.0.6

      access_policy.validator:
        class: Drupal\access_policy\AccessPolicyValidator
        arguments: ['@entity_type.manager', '@access_policy.content_policy_manager', '@plugin.manager.access_policy.access_rule']
    

    In version 1.0.7 we have additional parameter

      access_policy.validator:
        class: Drupal\access_policy\AccessPolicyValidator
        arguments: ['@entity_type.manager', '@access_policy.content_policy_manager', '@plugin.manager.access_policy.access_rule', '@plugin.manager.access_policy_operation']
    

    My question is to @gilbertdelyon are you using this service access_policy.validator somewhere in your custom module?

    Also @partdigital we still need to fix the Test cases where service is using only 3 parameters for testing.

  • πŸ‡«πŸ‡·France gilbertdelyon

    @partdigital
    In my test site:
    I uninstalled all none core modules (except Access_policy beta6)
    I updated to D10.2.3
    Update.php
    run cron
    admin > config > delete cache
    Then in terminal
    composer update drupal.access_policy

    [faoa3352@cantonais drupal.iaou.fr]$  composer update drupal.access_policy
    Loading composer repositories with package information
    Package "drupal.access_policy" listed for update is not locked.
    Updating dependencies
    Nothing to modify in lock file
    Installing dependencies from lock file (including require-dev)
    Nothing to install, update or remove
    Generating autoload files
    Hardening vendor directory with .htaccess and web.config files.
    42 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    Scaffolding files for drupal/core:

    back to admin > extensions
    Access_policy beta6 is still there

    Next step: I will reinstall a fresh D10.2.3 release and test again

    @rishabjasrotia

    My question is to @gilbertdelyon are you using this service access_policy.validator somewhere in your custom module?

    No, I dont use any kind of access_policy service in my custom modules

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

    @gilbertdelyon one thing I forgot to ask earlier. Did you run drush updb? That will update all your access policies with the new operations.

    Here are the steps that I went through to upgrade one of our projects to beta7.

    composer update drupal/access_policy 
    drush cr
    drush updb
    

    @rishabjasrotia which tests are you referring too? All tests are currently passing.

  • πŸ‡«πŸ‡·France gilbertdelyon

    @partigital
    Sorry I dont use drush yet.

    but as you can see in my previous comment
    When I enter composer update drupal/access_policy
    I get this answer in terminal:

    Loading composer repositories with package information
    Package "drupal.access_policy" listed for update is not locked.
    Updating dependencies
    Nothing to modify in lock file
    Installing dependencies from lock file (including require-dev)
    Nothing to install, update or remove

    Strange that there is Nothing to modify in lock file and Nothing to install, update or remove

    Then when I open foldersite/composer.json this what I see

     "require": {
            "composer/installers": "^2.0",
            "drupal/access_policy": "1.0.0-beta6",
  • πŸ‡ΊπŸ‡ΈUnited States partdigital

    Ah ok I hadn't realized that you weren't using drush. That's good to know for future updates. I just it ran the update against update.php and it seemed to work as well.

    In regards to the composer update did you try it with:

    composer update drupal/access_policy --with-all-dependencies
    

    In some cases I might also do it like this:

    composer require drupal/access_policy:1.0.0-beta7
    

    Note that I've never seen composer used like composer update drupal.access_policy. When I ran composer update drupal/access_policy it updated successfully.

    Here is a comparison of the messages between the two commands:

    composer update drupal.access_policy --with-all-dependencies

    Gathering patches from patch file.
    > DrupalProject\composer\ScriptHandler::checkComposerVersion
    Loading composer repositories with package information
    Package "drupal.access_policy" listed for update is not locked.
    Updating dependencies
    Nothing to modify in lock file
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Nothing to install, update or remove
    Package nabil1337/case-helper is abandoned, you should avoid using it. Use marcusball/case-helper instead.
    Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
    Generating autoload files
        Skipped installation of bin artifact for package lastcall/artifact.sh: file not found in package
    96 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    > DrupalProject\composer\ScriptHandler::createRequiredFiles
    > DrupalProject\composer\ScriptHandler::compileComposerServices
    Run "composer audit" for a full list of advisories
    

    composer update drupal/access_policy --with-all-dependencies

    Gathering patches from patch file.
    > DrupalProject\composer\ScriptHandler::checkComposerVersion
    Loading composer repositories with package information
    Updating dependencies                                 
    Lock file operations: 0 installs, 28 updates, 0 removals
      - Upgrading doctrine/lexer (2.1.0 => 2.1.1)
      - Upgrading drupal/access_policy (dev-1.0.x ba6a7ee => dev-1.0.x 3582651)
      - Upgrading egulias/email-validator (3.2.6 => 4.0.2)
      - Upgrading mck89/peast (v1.16.0 => v1.16.1)
      - Upgrading phpdocumentor/type-resolver (1.8.0 => 1.8.2)
      - Upgrading phpstan/phpdoc-parser (1.25.0 => 1.26.0)
      - Upgrading symfony/console (v6.4.3 => v6.4.4)
      - Upgrading symfony/dependency-injection (v6.4.3 => v6.4.4)
      - Upgrading symfony/error-handler (v6.4.3 => v6.4.4)
      - Upgrading symfony/http-foundation (v6.4.3 => v6.4.4)
      - Upgrading symfony/http-kernel (v6.4.3 => v6.4.4)
      - Upgrading symfony/mailer (v6.4.3 => v6.4.4)
      - Upgrading symfony/polyfill-ctype (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-iconv (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-intl-grapheme (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-intl-idn (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-intl-normalizer (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-mbstring (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-php72 (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-php80 (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-php81 (v1.28.0 => v1.29.0)
      - Upgrading symfony/polyfill-php83 (v1.28.0 => v1.29.0)
      - Upgrading symfony/process (v6.4.3 => v6.4.4)
      - Upgrading symfony/serializer (v6.4.3 => v6.4.4)
      - Upgrading symfony/string (v6.4.3 => v6.4.4)
      - Upgrading symfony/validator (v6.4.3 => v6.4.4)
      - Upgrading symfony/var-dumper (v6.4.3 => v6.4.4)
      - Upgrading symfony/var-exporter (v6.4.3 => v6.4.4)
    Writing lock file
    Installing dependencies from lock file (including require-dev)
    Package operations: 0 installs, 28 updates, 0 removals
      - Syncing drupal/access_policy (dev-1.0.x 3582651) into cache
    Gathering patches from patch file.
    Gathering patches for dependencies. This might take a minute.
      - Upgrading symfony/polyfill-ctype (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/polyfill-php80 (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/polyfill-php83 (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/polyfill-mbstring (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/http-foundation (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/var-dumper (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/error-handler (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/http-kernel (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/polyfill-intl-normalizer (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/polyfill-intl-grapheme (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/string (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/console (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading doctrine/lexer (2.1.0 => 2.1.1): Extracting archive
      - Upgrading symfony/validator (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/serializer (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/process (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/polyfill-iconv (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/polyfill-php72 (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/polyfill-intl-idn (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading symfony/var-exporter (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/dependency-injection (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading mck89/peast (v1.16.0 => v1.16.1): Extracting archive
      - Upgrading egulias/email-validator (3.2.6 => 4.0.2): Extracting archive
      - Upgrading drupal/access_policy (dev-1.0.x ba6a7ee => dev-1.0.x 3582651): Checking out 3582651d47 from cache
      - Upgrading phpstan/phpdoc-parser (1.25.0 => 1.26.0): Extracting archive
      - Upgrading symfony/mailer (v6.4.3 => v6.4.4): Extracting archive
      - Upgrading symfony/polyfill-php81 (v1.28.0 => v1.29.0): Extracting archive
      - Upgrading phpdocumentor/type-resolver (1.8.0 => 1.8.2): Extracting archive
    Package nabil1337/case-helper is abandoned, you should avoid using it. Use marcusball/case-helper instead.
    Package webmozart/path-util is abandoned, you should avoid using it. Use symfony/filesystem instead.
    Generating autoload files
        Skipped installation of bin artifact for package lastcall/artifact.sh: file not found in package
    96 packages you are using are looking for funding.
    Use the `composer fund` command to find out more!
    > DrupalProject\composer\ScriptHandler::createRequiredFiles
    > DrupalProject\composer\ScriptHandler::compileComposerServices
    
  • πŸ‡«πŸ‡·France gilbertdelyon

    Note that I've never seen composer used like composer update drupal.access_policy. When I ran composer update drupal/access_policy it updated successfully.

    Oups, Sorry, keyboard error from my side. You are right, i also use composer update drupal/access_policy.

    Another test:
    Access_policy beta 6 is installed.
    admin>extends>uninstall access_policy
    composer remove drupal/access_policy
    now the site is clear from any access_policy elements.

    composer require drupal/access_policy:1.0.0-beta6
    admin>extends>install access_policy
    it works but I dont set any rule

    composer update drupal/access_policy

    Loading composer repositories with package information
    Updating dependencies
    Nothing to modify in lock file
    Installing dependencies from lock file (including require-dev)
    Nothing to install, update or remove

    Very strange!

    Then admin > extend > uninstall access_policy
    composer remove drupal/access_policy

    composer require drupal/access_policy:1.0.0-beta7
    admin>extends>install access_policy
    it works!

    Notice that I have used composer this way to update contrib modules and this is the first time there is an issue.

  • πŸ‡«πŸ‡·France gilbertdelyon

    Finally I removed all elements of access_policy module in folder and db, installed beta7 version, reconfigure the rules
    It was a pain, but it woks!

  • Status changed to Closed: works as designed 4 months ago
  • πŸ‡ΊπŸ‡ΈUnited States partdigital

    Glad to hear you were able to update the module!

    Since it doesn't seem any code changes are necessary I'll close this as "Works as designed."

  • πŸ‡«πŸ‡·France gilbertdelyon

    OK,
    But I am now waiting for the next release and see if the same issue occurs again.
    Because in a fresh D10.2.3 with no other module than AP (free of any rule) I couldn't update from beta 6 to beta7 with composer update drupal/access_policy while I had no issue in other modules with same procedure.
    Wait and see!

Production build 0.69.0 2024