Problem/Motivation

I tryed to Upgrade von Domain Theme Switch 2.1.1 and Domain 2.0.1.
After upgrading both modules I get an error when trying an database-update with the following error:

The website encountered an unexpected error. Try again later.

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: You have requested a non-existent service "domain_config_ui.manager". Did you mean this: "locale.config_manager"? in Drupal\Component\DependencyInjection\Container->get() (line 159 of core/lib/Drupal/Component/DependencyInjection/Container.php).
Drupal\domain_theme_switch\Form\DomainThemeSwitchConfigForm::create() (Line: 41)
Drupal\Core\DependencyInjection\ClassResolver->getInstanceFromDefinition() (Line: 48)
Drupal\Core\Controller\HtmlFormController->getFormObject() (Line: 58)
Drupal\Core\Controller\FormController->getContentResult()
call_user_func_array() (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 637)
Drupal\Core\Render\Renderer->executeInRenderContext() (Line: 121)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext() (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 181)
Symfony\Component\HttpKernel\HttpKernel->handleRaw() (Line: 76)
Symfony\Component\HttpKernel\HttpKernel->handle() (Line: 53)
Drupal\Core\StackMiddleware\Session->handle() (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle() (Line: 28)
Drupal\Core\StackMiddleware\ContentLength->handle() (Line: 32)
Drupal\big_pipe\StackMiddleware\ContentLength->handle() (Line: 116)
Drupal\page_cache\StackMiddleware\PageCache->pass() (Line: 90)
Drupal\page_cache\StackMiddleware\PageCache->handle() (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle() (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle() (Line: 36)
Drupal\Core\StackMiddleware\AjaxPageState->handle() (Line: 51)
Drupal\Core\StackMiddleware\StackedHttpKernel->handle() (Line: 741)
Drupal\Core\DrupalKernel->handle() (Line: 19)

And I am getting an white page, too.

The updatedb says:

hook_update_n (10001) failed. You have requested a non-existent service "domain_config_ui.manager

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

dbielke1986 created an issue. See original summary.

dbielke1986’s picture

Priority: Normal » Critical

mably made their first commit to this issue’s fork.

mably’s picture

Status: Active » Needs review

Hi @dbielke1986,

Thanks for the detailed report. The fix is up as MR !16. Rather than just adding the missing dependency declaration, it removes the use of the domain_config_ui.manager service entirely so domain_theme_switch works on sites that do not have domain_config_ui enabled — your case — without forcing every site to install the UI submodule.

The runtime mechanism that actually applies the per-domain theme override comes from domain_config's tagged config.factory.override service, which works whether or not domain_config_ui is enabled. The form and the migration update hook now go through domain.config_factory_override directly. The functional test was updated to drop domain_config_ui from $modules, so it now exercises exactly the path you hit.

If you can apply this branch on your environment and confirm that the upgrade now completes update_10001 without the WSOD, I'll roll it into a 3.0.1 tag.

MR: https://git.drupalcode.org/project/domain_theme_switch/-/merge_requests/16

dbielke1986’s picture

Hey @mably,

Wow, that was a great response and a ton of information.
Thank you so much for the detailed explanation and, above all, the fix.

I’ll try to test it on my end, but I can only do that when the server isn’t under much load.
I took a look at the MR, but I have a question about it:

Why has a dependency on “domain:domain_config” been added? I currently only have “domain:domain” active because that’s the only feature I need: registering multiple domains and switching themes depending on the domain.

Why do I now have to enable Domain Configuration when I don’t need that feature?

mably’s picture

domain_config is required to manage configuration per domain.

Here, it is used to override system.theme for each domain.

As soon as you confirm that the fix is working fine for you I'll merge it.

dbielke1986’s picture

Status: Needs review » Reviewed & tested by the community

Ok, so I will need to activate this sub-module before upgrading, too.
I already did the upgrade and installed the MR before running an updatedb.

...and what can I say?! It worked.
With the change from the MR, I was able to access all the configuration pages again, and my test of the website—admittedly quite brief and quick—was successful.

So, a huge thank you from me, and the green light for 3.0.1

  • mably committed 08a0d82e on 3.x
    fix: #3588538 Symfony\Component\DependencyInjection\Exception\...
mably’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

dbielke1986’s picture

Status: Fixed » Closed (fixed)

3.0.1 is working fine - I already updated our system.

Thank you so much!

mably’s picture

Adding a new guard to block update until domain_config has been enabled.