I Just upgraded my site to drupal 8.6.0 and now when I'am trying to place a bock in a region I'll get an unexpected error.
The website encountered an unexpected error. Please try again later.
Error: Call to undefined method Drupal\Core\TypedData\TypedDataManager::createFromNameAndData() in Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter->getConfigTypedData() (line 100 of core/lib/Drupal/Core/Entity/Plugin/DataType/ConfigEntityAdapter.php).
Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter->getConfigTypedData() (Line: 65)
Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter->getIterator() (Line: 146)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validateNode(Object, Array, 1) (Line: 99)
Drupal\Core\TypedData\Validation\RecursiveContextualValidator->validate(Object, Array, NULL) (Line: 90)
Drupal\Core\TypedData\Validation\RecursiveValidator->validate(Object, Array) (Line: 346)
Drupal\Core\Plugin\Context\ContextDefinition->isSatisfiedBy(Object) (Line: 69)
Drupal\Core\Plugin\Context\ContextHandler->Drupal\Core\Plugin\Context\{closure}(Object)
array_filter(Array, Object) (Line: 70)
Drupal\Core\Plugin\Context\ContextHandler->getMatchingContexts(Array, Object) (Line: 40)
Drupal\Core\Condition\ConditionPluginBase->addContextAssignmentElement(Object, Array) (Line: 55)
Drupal\Core\Condition\ConditionPluginBase->buildConfigurationForm(Array, Object) (Line: 76)
Drupal\domain\Plugin\Condition\Domain->buildConfigurationForm(Array, Object) (Line: 255)
Drupal\block\BlockForm->buildVisibilityInterface(Array, Object) (Line: 142)
Drupal\block\BlockForm->form(Array, Object) (Line: 117)
Drupal\Core\Entity\EntityForm->buildForm(Array, Object)
call_user_func_array(Array, Array) (Line: 518)
Drupal\Core\Form\FormBuilder->retrieveForm('block_form', Object) (Line: 275)
Drupal\Core\Form\FormBuilder->buildForm('block_form', Object) (Line: 48)
Drupal\Core\Entity\EntityFormBuilder->getForm(Object) (Line: 27)
Drupal\block\Controller\BlockAddController->blockAddConfigureForm('views_block:events-block_1', 'my_theme')
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 582)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 151)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 68)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 99)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 78)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 665)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Comments
Comment #2
cilefen commentedWould you please summarize the upgrade process that happened on the site?
Comment #3
alexpottDrupal\Core\TypedData\TypedDataManager::createFromNameAndData()method does exist in core/lib/Drupal/Core/Config/TypedConfigManager.php.@rbosscher there are a couple of things that come to mind that can cause this:
Comment #4
alexpottOh I'm wrong core/lib/Drupal/Core/TypedData/TypedDataManager.php does not have this method. So the question becomes why did ConfigEntityAdapter->getConfigTypedData() not return the config version.
Comment #5
alexpottLooking at the code. \Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter::getTypedDataManager() should return \Drupal::service('config.typed'). That should be the config version. So maybe something in the install is replacing this for some reason.
@rbosscher if you have drush installed can use the
phpcommand to run the following code and paste the output here.Here's the output from a vanilla 8.6.0 install:
Comment #6
rbosscher commentedI've upgraded the site with composer.
In the composer.json I altered:
Next I've run the command:
composer update drupal/core webflo/drupal-core-require-dev --with-dependenciesNext update the database:
drush updb@alexpot
I've runned the script:
drush phpComment #7
rbosscher commentedThank you for the quick response BTW
Meanwhile I've restarted the webserver.
Manually cleared the opcache and drupal cache.
But unfortunately no luck
I do see a difference in the line numbers?
TypedConfigManager {#1695 VS TypedConfigManager {#872
Comment #8
alexpott@rbosscher thank you for the extra information.
I've tested placing block after the upgrade and I can not reproduce the error. There might be some module that is causing problems - if you could paste the list of modules that you have installed that'd be great The output of the command
drush config-get core.extension moduleis the easiest way to get that.Again looking at the code I have a hunch that \Drupal\Core\Plugin\Context\Context::createFromContext() might be causing this somehow because it is copying type data managers between contexts.
You could try commenting out the line
$context->setTypedDataManager($old_context->getTypedDataManager());and let us know if it fixes the issue.Comment #9
ohmdesbois commentedEmptying the caches, updating the entities and the base do not solve the problem.
I tried to disable the modules one by one to determine which one is problematic, without success at the moment.
Comment #10
rbosscher commentedMeanwhile I have it working again.
I found the problem as follows:
In the file \core\lib\Drupal\Core\Entity\Plugin\DataType\ConfigEntityAdapter.php
I added the following two print_r
These gave some intell in what the function was doing.
It turned out to show some information about the domain domain module
I've upgraded that to the latest dev and I was able to place the blocks in the regions again.
So still not sure why, but for me it has solved it.
Comment #11
alexpott@rbosscher thanks for finding that out and sharing your fix.
@ohmdesbois are you using the domain module as well and does upgrading that module fix the issue for you too?
Comment #12
jmaties commentedSame issue, but also i can't configure blocks.
Comment #13
alexpott@jmaties are you using domain? There might be some module that is causing problems - if you could paste the list of modules that you have installed that'd be great The output of the command
drush config-get core.extension moduleis the easiest way to get that. Any extra information you can provide would be most welcome.Comment #14
jmaties commentedYes i use domain, but i disable this without success:
'core.extension:module':
admin_toolbar: 0
automated_cron: 0
block: 0
block_class: 0
block_content: 0
breakpoint: 0
ckeditor: 0
config: 0
config_translation: 0
ctools: 0
datetime: 0
dblog: 0
devel: 0
devel_generate: 0
domain: 0
domain_access: 0
domain_config: 0
domain_content: 0
domain_site_settings: 0
domain_theme_switch: 0
editor: 0
entity_reference_revisions: 0
field: 0
field_group: 0
field_ui: 0
file: 0
filter: 0
history: 0
image: 0
kint: 0
language: 0
link: 0
locale: 0
media: 0
menu_link_attributes: 0
menu_ui: 0
moringa_varios: 0
node: 0
options: 0
path: 0
rdf: 0
shortcut: 0
svg_image: 0
system: 0
taxonomy: 0
text: 0
token: 0
toolbar: 0
twig_tweak: 0
twig_vardumper: 0
update: 0
user: 0
views_block_area: 0
views_fieldsets: 0
views_load_more: 0
views_ui: 0
webform: 0
webform_ui: 0
menu_link_content: 1
pathauto: 1
content_translation: 10
views: 10
paragraphs: 11
Comment #15
jmaties commentedI have disabled all domain modules and it work...
This is maybe a domain bug?
Comment #16
rbosscher commentedI think so, have you tried the latest dev: https://www.drupal.org/project/domain/releases/8.x-1.x-dev That helped me around the problem
Comment #17
jmaties commentedYes, with dev version work fine ;)
Thanks
Comment #18
alexpottAfter message @agentrickard about this in slack, @berdir pointed me to #2982183: Conflict between TypedDataManager and TypedConfigManager in ConfigEntityAdapter - so this is a duplicate.
Comment #19
ohmdesbois commented@alexpott No, I do not use the domain module.
Is it interresing that I post the list of modules used?