- 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 errorThe 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 thereNext 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 entercomposer 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 rancomposer 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 rulecomposer 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
9 months ago 4:43pm 1 March 2024 - πΊπΈ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 withcomposer update drupal/access_policy
while I had no issue in other modules with same procedure.
Wait and see!