I just did a fresh install of HEAD and the toolbar subtrees are not showing up for me. I log in as user 1 but the HTTP request to /toolbar/subtrees/rStojJK4QAQL2vAsoEXOi1IZXw38Gihuqk7qQPI7UWw returns a 403 response with this body:

The website encountered an unexpected error. Please try again later.

Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 113 of core/lib/Drupal/Core/Routing/AccessAwareRouter.php).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Wim Leers’s picture

Confirmed, this is a regression introduced by #2217985: Replace the custom menu caching strategy in Toolbar with Core's standard caching.. Despite all the manual testing :( Clearly, our test coverage in that area is lacking.

Working on fix + tests.

Wim Leers’s picture

Assigned: Wim Leers » Unassigned
Status: Active » Needs review
FileSize
2.47 KB
811 bytes
Fabianx’s picture

Status: Needs review » Reviewed & tested by the community

RTBC, looks great!

Wim Leers’s picture

LOL, my "test-only" test is actually WITHOUT the test, only with the fix. So it won't fail. Uploaded the right one.

No changes to the regular patch.

The last submitted patch, 4: toolbar_subtrees-2534830-4-test-only-FAIL.patch, failed testing.

Wim Leers’s picture

Issue tags: +Quickfix
alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 0feb1b6 and pushed to 8.0.x. Thanks!

  • alexpott committed 0feb1b6 on 8.0.x
    Issue #2534830 by Wim Leers: Toolbar subtrees not working
    
longwave’s picture

Status: Fixed » Active
Issue tags: -Quickfix

This still isn't working for me; I see exactly the same behaviour with latest HEAD locally, and I also checked it out on simplytest.me to make sure it wasn't some local environment thing.

Steps to reproduce:

1. Install Drupal with standard profile
2. Log in as user 1
3. Switch the toolbar to vertical orientation
4. Open the Network tab in your inspector
5. Click Structure (or any of the other top level menu items)
6. Note that the subtree is not displayed and there is a 403 response in the inspector

Wim Leers’s picture

Status: Active » Postponed (maintainer needs more info)

#9: did you clear your browser cache? I just reinstalled HEAD, cleared my browser cache, logged in, and it works.

longwave’s picture

Yep, as I said I also tried it on a new simplytest.me instance, which is still available here: https://dami.ply.st/ (log in as admin/admin)

Fabianx’s picture

I can confirm that there is a 403 access denied error that is cached by Drupal's core cache (X-Drupal-Cache: HIT)

Wim Leers’s picture

#11: as discussed in IRC: I cannot even reproduce it over there, on simplytest.me (not even on the exact instance where you had the problem)! So… it seems like this is a problem that's only triggered with specific clients.

#12: STR? I can't reproduce this at all :/

Fabianx’s picture

#13: I click on the above link:

- I put the sidebar in vertical
- I click on Structure (but _not_ on the arrow):

Expected result:

- Structure expands down (that might be an expectation error, so could be fine)
- There is no 403 error

Actual result:

- Structure opens the /admin/structure page and 403 can be seen in XHR Tab of chrome network inspector.
- All arrows vanish

Wim Leers’s picture

- I click on Structure (but _not_ on the arrow):

To expand, one must click *on* the arrow. Clicking on the link itself means navigating to that link.

Wim Leers’s picture

Assigned: Unassigned » Wim Leers
Status: Postponed (maintainer needs more info) » Active

But now I've been able to reproduce the 403. This is a separate problem from the bug that was already fixed in #4 + #7.

Wim Leers’s picture

Found the root cause. This is a bug that has existed in Toolbar since the very beginning, but is only exposed since #2217985: Replace the custom menu caching strategy in Toolbar with Core's standard caching.. The problem is that we calculate the subtrees hash in the current theme (so Bartik on the frontpage, Seven on /admin/structure), but during the AJAX request, we always use the default theme.

This causes the hashes to be different, and hence the 403… on admin pages only.

(Go to /admin/appearance, and use Bartik as the administration theme, and it'll work at /admin/structure as well.)

Opening a new issue for that. We're definitely missing test coverage for that too.

Wim Leers’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

Rar9’s picture

hi i applied patch 4, but I still get above issue

D9.1.10
Lang DE as default + eng + Account administration pages

Path: /en/toolbar/subtrees/kEIgVbrAnk8tVlQ2I7zujQnIh9zFpVDT4RPSO9jovOs?_wrapper_format=drupal_ajax. Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException: in Drupal\Core\Routing\AccessAwareRouter->checkAccess() (line 120 of /var/www/vhosts/drupal9/web/core/lib/Drupal/Core/Routing/AccessAwareRouter.php).

tarik.cipix’s picture

Yeah same, this issue is not fixed, when you add a second language and enable the detection method account administration pages you get the same 403 as reported in the issue summary

Drupal Core 8.9.16, please re-open.

DiDebru’s picture

Drupal core 8.9.17
We are facing the same issue.
default engl with 5 other languages.

candelas’s picture

Same problem with Drupal 9.2.4 after enabling detection method account administration pages.

mlncn’s picture

Also seeing this. Can this be re-opened or is there a similar issue somewhere? Seeing it on node/add with a subtheme of Claro (Encontrarlo).

longwave’s picture

Please open a new issue describing the problem, with a set of steps to reproduce from a fresh install if possible.

leisurman’s picture

Same problem with Drupal 9.3

POST http://au1/toolbar/subtrees/VAQdABldryPtu9HzNVIjx1cgriyLzPRGyWJdtSLaUAo?_wrapper_format=drupal_ajax 403 (Forbidden)

Uncaught Drupal.AjaxError {message: "\nAn AJAX HTTP error occurred.\nHTTP Result Code: 40…tatusText: Forbidden\nResponseText: {\"message\":\"\"}", name: "AjaxError"}

leisurman’s picture