- Issue created by @keithkhl
- π°π·South Korea keithkhl
Just double checked that after removing the default domain, I can access the /admin/content page again. Now, the main page (www.example.com) is not accessible.
- πΊπΈUnited States kevinquillen
I ran into this with a misconfigured Site Studio component and a Link field that was returning "" because it could not look up the user input value, it did not resolve to any entity in the database.
The problem was here:
/** * {@inheritdoc} */ public function processOutbound($path, &$options = [], Request $request = NULL, BubbleableMetadata $bubbleable_metadata = NULL) { // Load the active domain if not set. $active_domain = $options['active_domain'] ?? $this->getActiveDomain(); // Only act on valid internal paths and when a domain loads. $external = $options['external'] ?? FALSE; if (is_null($active_domain) || $path === '' || $external === TRUE) { return $path; } // Set the default source information. $source = NULL; $options['active_domain'] = $active_domain; $entity = NULL; // Get the current language. $langcode = NULL; if (isset($options['language'])) { $langcode = $options['language']->getId(); } // Get the URL object for this request. $alias = $this->aliasManager->getPathByAlias($path, $langcode); $url = Url::fromUserInput($alias, $options);
I think at a minimum the lines:
// Get the URL object for this request. $alias = $this->aliasManager->getPathByAlias($path, $langcode); $url = Url::fromUserInput($alias, $options);
should be wrapped in a try catch. Log the path, request, options, alias and
return $path
. That gives someone a chance to trace back where the input came from, potentially, and lets pages load.I could not access the Content admin, URL Alias page, URL Redirect page, or the Admin Content view or areas like that until I resolved this.
To get back up and going to debug the problem for your specific local database, you can do:
if ($path == '') { return $path; } // Get the URL object for this request. $alias = $this->aliasManager->getPathByAlias($path, $langcode); $url = Url::fromUserInput($alias, $options);
in DomainSourcePathProcessor.php. That will prevent the pages from crashing so you can trace back the error. In my case, I snagged a database, fixed the content issue, and pushed the database back under maintenance to get the site back online.
- Merge request !127Add try/catch around Url processing and log a more helpful error. β (Open) created by kevinquillen
- πΊπΈUnited States kevinquillen
I tried looking at other examples of outbound processors in core and contrib, but I could not locate any that themselves called
Url::fromUserInput
. The only route I can think of is to at least try/catch here so it prevents the OP from occurring and offers some way of recovering and fixing the data.This was really hard to replicate - somehow my issue (and assume OP issue) was that
$path
was passed as NULL (or ''). Which should not happen, and the how it happened... not quite sure. But a try/catch won't harm anything here.