Problem / Motivation

On drupal/webform version 5.2.0 and Drupal 8.8.8.

If you are rendering entities in a search index, you may see this error on index:

InvalidArgumentException while trying to render item (entityidhere) with view mode full for search index Acquia Search Solr Index: Route required in Drupal\Core\Url::fromRouteMatch()

The error is happening because modules/webform_access/src/Breadcrumb/WebformAccessBreadcrumbBuilder.php calls Url::fromRouteMatch($route_match) but $route_match does not have a route object.

Proposed Resolution

Add a condition to check for the route object. If the route object does not exist, do not render a link.

Comments

josephdpurcell created an issue. See original summary.

josephdpurcell’s picture

The attached patch resolves the issue. I did not test to confirm there are not negative side-effects of this.

josephdpurcell’s picture

Status: Active » Needs review

This patch at least solves the immediate issue seen on index. This should get reviewed to make sure its not causing bad behavior elsewhere.

josephdpurcell’s picture

Adding issues in other modules and code that cause issues due to fromRouteMatch() throwing an exception.

jrockowitz’s picture

Status: Needs review » Fixed

@josephdpurcell I hope all is well with you. Thanks for the patch.

  • josephdpurcell authored 9863ce8 on 8.x-5.x
    Issue #3158332 by josephdpurcell: InvalidArgumentException while trying...

  • josephdpurcell authored 9863ce8 on 6.x
    Issue #3158332 by josephdpurcell: InvalidArgumentException while trying...

Status: Fixed » Closed (fixed)

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