Problem/Motivation
On updating a site from Drupal 11.3.x to 11.4.x the content search page started returning "access denied" for all users, including user 1. Note that the user search page seems to not return the same error.
The routes for the search pages are all generated by search/src/Routing/SearchPageRoutes.php which uses an array of symfony Route objects, as opposed to a RouteCollection. I did refactor it into the latter locally, but that seems to have made no difference.
Steps to reproduce
* Install a clean Drupal 11.4.x with the "standard" profile.
* Enable search module.
* Add a content search page.
* Try to access the content search page.
* Nope
Issue fork drupal-3611516
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
cafuego commentedI added my refactored code to this PR and on clearing the local php container, it seems to now somehow work. Still no joy on the dev instance of a non-fresh install though, so I will now throw my hands in the air.
Comment #3
cafuego commentedAh! The search_node plugin in the node module is hard-coded to return AccessResult::forbidden(); and that seems to be the one Drupal wants to use, not the one under the search_node sub-module in search.
Deleting the plugin from node module and enabling search_node module resolves the problem.
Comment #4
cafuego commentedComment #5
cafuego commentedComment #6
handkerchiefAnother possible cause for this error:
On one Drupal 11.4.x site, `/search` returned a `CacheableAccessDeniedHttpException`, although `search_node` was enabled.
The active plugin class was:
Drupal\trash\Plugin\Search\TrashNodeSearchThe issue was caused by Trash 3.0.29. Updating to Trash 3.0.30 and rebuilding the caches resolved the problem:
Before modifying any core files, check which class provides the `node_search` plugin. If it is `Drupal\trash\Plugin\Search\TrashNodeSearch`, update the Trash module first.
Comment #7
catch@cafuego it should work as long as search_node is enabled without modifying any core code. Could you check that?
Comment #8
cafuego commented@catch It did, eventually and it reliably works now on the one site I use it on. I've tested with some restore-end re-upgrade steps.
I'm not sure why it originally failed, maybe because at first our scripts went via 11.4.1 and that managed to decide the plugin under node module was the one to use. On the latest checks I jump directly from 11.3.x to 11.4.4 and it seems happy enough to grab the one from search_node.
Comment #9
catchThanks for confirming. I'm going to go ahead and close this as 'cannot reproduce' because it sounds like it's OK. Wondering if the original failed update led to the search_node module not being installed at all.