Error: Call to a member function getCleanUrl() on null in /var/www/doris/web/modules/composer/search_api_page/src/Controller/SearchApiPageController.php on line 40

To replicate:

Disable core search module.
Create an index in search api.
Create a search page with a path of /search, I have not tested with a different path yet.
Delete the index in search api
Browse to /search and get the error previously mentioned.

I'm assuming at this stage, that the action of deleting the index deletes the page that uses it but not it's path.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

thursday_bw created an issue. See original summary.

mr.baileys’s picture

I'm assuming at this stage, that the action of deleting the index deletes the page that uses it but not it's path.

That is correct, the Search API Page config entity has a dependency on the Search API Index, so when the latter is deleted, the Search API Page is removed too. Routes cannot declare a dependency on a config entity (I think), so the route to the page remains unaffected. If you force the routes to be rebuild, you will get the expected 404 rather than the fatal error.

Since the Search API Page has been cleaned up, all we need to do is force a router rebuild, patch attached. This still needs tests, but since HEAD is current broken (#2825685: Tests are currently broken.), I'll hold off on writing those until that patch lands.

Status: Needs review » Needs work

The last submitted patch, 2: error_access_url_of-2801021-2.patch, failed testing.

The last submitted patch, 2: error_access_url_of-2801021-2.patch, failed testing.

The last submitted patch, 2: error_access_url_of-2801021-2.patch, failed testing.

mr.baileys’s picture

Status: Needs work » Needs review

Tests are fixed now that #2825685: Tests are currently broken. has landed, back to needs review.

borisson_’s picture

Status: Needs review » Reviewed & tested by the community

Looks good, a test could be useful but not needed I think.

  • swentel committed b8d7ba3 on 8.x-1.x authored by mr.baileys
    Issue #2801021 by mr.baileys: Error access URL of search page after...
swentel’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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