This is a new one for me:
All routes, for an authenticated user, resolve to entity.user.edit_form
.
Anonymous users are able to browse all public-facing pages of the site without any problems.
This is the route:
$ ddev drush core:route --name=entity.user.edit_form
name: entity.user.edit_form
path: '/user/{user}/edit'
defaults:
_entity_form: user.default
_title_callback: 'Drupal\user\Controller\UserController::userTitle'
requirements:
user: \d+
_entity_access: user.update
options:
_admin_route: true
parameters:
user:
type: 'entity:user'
converter: paramconverter.entity
_access_checks:
- access_check.entity
There doesn't seem to be anything wrong with this particular route -- it's all the other ones that don't behave as expected.
For what it's worth:
Drupal version : 9.4.5
PHP version : 7.4.30
The problem surfaced on a remote production site running on Microsoft Azure (Kudu / IIS); I have imported its database, for testing purposes, into a DDEV-Local environment (Docker / Linux).
In the remote environment, the following route-related errors appeared in the dblog:
$ ddev drush ws
--------- -------------- ------------------ ---------- ---------------------------------------------
ID Date Type Severity Message
--------- -------------- ------------------ ---------- ---------------------------------------------
5692475 04/Oct 20:10 php Error Symfony\Component\Routing\Exception\RouteNotFou
ndException: Route "devel.configs_list" does
not exist. in
Drupal\Core\Routing\RouteProvider->getRouteByNa
me() (line 206 of D:\home\site\wwwr
5692474 04/Oct 20:10 php Error Symfony\Component\Routing\Exception\RouteNotFou
ndException: Route "devel.configs_list" does
not exist. in
Drupal\Core\Routing\RouteProvider->getRouteByNa
me() (line 206 of D:\home\site\wwwr
5692473 04/Oct 20:10 php Error Symfony\Component\Routing\Exception\RouteNotFou
ndException: Route "devel.configs_list" does
not exist. in
Drupal\Core\Routing\RouteProvider->getRouteByNa
me() (line 206 of D:\home\site\wwwr
5692472 04/Oct 20:10 php Error Symfony\Component\Routing\Exception\RouteNotFou
ndException: Route "devel.configs_list" does
not exist. in
Drupal\Core\Routing\RouteProvider->getRouteByNa
me() (line 206 of D:\home\site\wwwr
--------- -------------- ------------------ ---------- ---------------------------------------------
In the DDEV-Local environment, I executed the following commands:
$ ddev drush eval '\Drupal::service("router.builder")->rebuild();'
$ ddev drush cr
[success] Cache rebuild complete.
After rebuilding the routes, the error no longer appears in the logs; however, all routes now arrive at the logged-in user's profile edit form.
In comments, @jaypan said:
Disable the devel module and any devel related modules, and see if that resolves it.
This is a good suggestion. Those modules are already disabled:
$ ddev drush pml |grep devel
Development Devel (devel) Disabled 4.1.3
Development Devel Generate (devel_generate) Disabled 4.1.3
Webform Webform Devel (webform_devel) Disabled 6.1.2
They are present in the composer.json
:
$ grep devel composer.json
"drupal/devel": "^4.1",
"drupal/devel_generate": "^4.1",
I am able to enable them without error:
$ ddev drush en devel devel_generate
[success] Successfully enabled: devel, devel_generate
This does not fix the routes.
I am able to disable them without error:
$ ddev drush pmu devel devel_generate
[success] Successfully uninstalled: devel, devel_generate
This also does not fix the routes.
The previous developer was unable to use Drush in this environment and appears to have been using raw SQL queries to clear caches (truncate
all the cache tables) and disable modules. The errors are quite likely related to that approach.
Update (2022-10-07)
In comments, @cilefen asked:
Did any known platform or codebase change precipitate this? Are any custom modules installed? Is there a version control log? Have you restored from backups to identify when or how this changed?
I still do not have access to the client's VPN, so I can't access their version control repositories directly. We have restored the database from backups that predate the problem, so I now think the problem may be caused by Azure DevOps being configured to deploy the built artifact on top of the previously-installed files.
Troubleshooting from another angle, I have used curl
to capture an authentication cookie:
$ curl --cookie cookie.txt --cookie-jar cookie.txt $(ddev drush uli)
Now, when I use curl
to request a page as an authenticated user, I receive this:
$ curl --cookie cookie.txt https://clientsite.ddev.site
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 414 0 414 0 0 3568 0 --:--:-- --:--:-- --:--:-- 3568
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta http-equiv="refresh" content="0;url='https://clientsite.ddev.site/user/1/edit'" />
<title>Redirecting to https://clientsite.ddev.site/user/1/edit</title>
</head>
<body>
Redirecting to <a href="https://clientsite.ddev.site/user/1/edit">https://clientsite.ddev.site/user/1/edit</a>.
</body>
</html>%
This appears to show that the redirect is caused by <meta http-equiv="refresh" content="0;url='https://clientsite.ddev.site/user/1/edit'" />
rather than by corruption in the routing table.
I hope I'm getting close to resolving this. (If not, I might add a bounty to the question in 10 hours!)