DB Update Error: TypeError: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}(): Argument #1 ($definition) must be of type Drupal\Core\Field\FieldStorageDefinitionInterface, null given

Created on 28 June 2023, over 1 year ago

Problem/Motivation

When updating from version 2.0.0-beta1 to version 2.0.0, an error occurs.
This happens when the following update step is performed:
Configure the view display for subscription licenses.

Steps to reproduce

The following error occurs when running drush updb after upgrading code from version 2.0.0-beta1 to version 2.0.0:

[error] TypeError: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}(): Argument #1 ($definition) must be of type Drupal\Core\Field\FieldStorageDefinitionInterface, null given in Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}() (line 175 of /code/web/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php) #0 [internal function]: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}(NULL)
> #1 /code/web/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php(177): array_filter(Array, Object(Closure))
> #2 /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(381): Drupal\Core\Entity\Sql\DefaultTableMapping::create(Object(Drupal\Core\Entity\ContentEntityType), Array, '')
> #3 /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(356): Drupal\Core\Entity\Sql\SqlContentEntityStorage->getCustomTableMapping(Object(Drupal\Core\Entity\ContentEntityType), Array)
> #4 /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(203): Drupal\Core\Entity\Sql\SqlContentEntityStorage->getTableMapping()
> #5 /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(188): Drupal\Core\Entity\Sql\SqlContentEntityStorage->initTableLayout()
> #6 /code/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(156): Drupal\Core\Entity\Sql\SqlContentEntityStorage->__construct(Object(Drupal\Core\Entity\ContentEntityType), Object(Drupal\mysql\Driver\Database\mysql\Connection), Object(Drupal\Core\Entity\EntityFieldManager), Object(Drupal\Core\Update\UpdateBackend), Object(Drupal\Core\Language\LanguageManager), Object(Drupal\Core\Cache\MemoryCache\MemoryCache), Object(Drupal\Core\Entity\EntityTypeBundleInfo), Object(Drupal\Core\Entity\EntityTypeManager))
> #7 /code/web/modules/contrib/commerce/src/CommerceContentEntityStorage.php(28): Drupal\Core\Entity\Sql\SqlContentEntityStorage::createInstance(Object(Drupal\Core\DependencyInjection\ContainerBuilder), Object(Drupal\Core\Entity\ContentEntityType))
> #8 /code/web/modules/contrib/commerce/modules/product/src/ProductVariationStorage.php(35): Drupal\commerce\CommerceContentEntityStorage::createInstance(Object(Drupal\Core\DependencyInjection\ContainerBuilder), Object(Drupal\Core\Entity\ContentEntityType))
> #9 /code/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(269): Drupal\commerce_product\ProductVariationStorage::createInstance(Object(Drupal\Core\DependencyInjection\ContainerBuilder), Object(Drupal\Core\Entity\ContentEntityType))
> #10 /code/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(258): Drupal\Core\Entity\EntityTypeManager->createHandlerInstance('Drupal\\commerce...', Object(Drupal\Core\Entity\ContentEntityType))
> #11 /code/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(192): Drupal\Core\Entity\EntityTypeManager->getHandler('commerce_produc...', 'storage')
> #12 /code/web/core/modules/views/src/EntityViewsData.php(107): Drupal\Core\Entity\EntityTypeManager->getStorage('commerce_produc...')
> #13 /code/web/modules/contrib/commerce/src/CommerceEntityViewsData.php(58): Drupal\views\EntityViewsData::createInstance(Object(Drupal\Core\DependencyInjection\ContainerBuilder), Object(Drupal\Core\Entity\ContentEntityType))
> #14 /code/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(269): Drupal\commerce\CommerceEntityViewsData::createInstance(Object(Drupal\Core\DependencyInjection\ContainerBuilder), Object(Drupal\Core\Entity\ContentEntityType))
> #15 /code/web/core/lib/Drupal/Core/Entity/EntityTypeManager.php(258): Drupal\Core\Entity\EntityTypeManager->createHandlerInstance('Drupal\\commerce...', Object(Drupal\Core\Entity\ContentEntityType))
> #16 /code/web/core/modules/views/views.views.inc(179): Drupal\Core\Entity\EntityTypeManager->getHandler('commerce_produc...', 'views_data')
> #17 /code/web/core/modules/views/src/ViewsData.php(236): views_views_data()
> #18 /code/web/core/lib/Drupal/Core/Extension/ModuleHandler.php(405): Drupal\views\ViewsData->Drupal\views\{closure}(Object(Closure), 'views')
> #19 /code/web/core/modules/views/src/ViewsData.php(244): Drupal\Core\Extension\ModuleHandler->invokeAllWith('views_data', Object(Closure))
> #20 /code/web/core/modules/views/src/ViewsData.php(154): Drupal\views\ViewsData->getData()
> #21 /code/web/core/modules/views/src/Plugin/Derivative/ViewsEntityRow.php(94): Drupal\views\ViewsData->get('aggregator_feed')
> #22 /code/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(101): Drupal\views\Plugin\Derivative\ViewsEntityRow->getDerivativeDefinitions(Array)
> #23 /code/web/core/lib/Drupal/Component/Plugin/Discovery/DerivativeDiscoveryDecorator.php(87): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDerivatives(Array)
> #24 /code/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(291): Drupal\Component\Plugin\Discovery\DerivativeDiscoveryDecorator->getDefinitions()
> #25 /code/web/core/lib/Drupal/Core/Plugin/DefaultPluginManager.php(181): Drupal\Core\Plugin\DefaultPluginManager->findDefinitions()
> #26 /code/web/core/lib/Drupal/Component/Plugin/Discovery/DiscoveryCachedTrait.php(22): Drupal\Core\Plugin\DefaultPluginManager->getDefinitions()
> #27 /code/web/core/lib/Drupal/Core/Plugin/Factory/ContainerFactory.php(16): Drupal\Core\Plugin\DefaultPluginManager->getDefinition('data_field')
> #28 /code/web/core/lib/Drupal/Component/Plugin/PluginManagerBase.php(83): Drupal\Core\Plugin\Factory\ContainerFactory->createInstance('data_field', Array)
> #29 /code/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(816): Drupal\Component\Plugin\PluginManagerBase->createInstance('data_field')
> #30 /code/web/core/modules/views/src/Plugin/views/style/StylePluginBase.php(122): Drupal\views\Plugin\views\display\DisplayPluginBase->getPlugin('row')
> #31 /code/web/core/modules/views/src/Plugin/views/display/DisplayPluginBase.php(819): Drupal\views\Plugin\views\style\StylePluginBase->init(Object(Drupal\views\ViewExecutable), Object(Drupal\views_data_export\Plugin\views\display\DataExport), Array)
> #32 /code/web/core/modules/rest/src/Plugin/views/display/RestExport.php(346): Drupal\views\Plugin\views\display\DisplayPluginBase->getPlugin('style')
> #33 /code/web/core/modules/views/src/EventSubscriber/RouteSubscriber.php(120): Drupal\rest\Plugin\views\display\RestExport->collectRoutes(Object(Symfony\Component\Routing\RouteCollection))
> #34 [internal function]: Drupal\views\EventSubscriber\RouteSubscriber->routes()
> #35 /code/web/core/lib/Drupal/Core/Routing/RouteBuilder.php(146): call_user_func(Array)
> #36 /code/web/core/lib/Drupal/Core/ProxyClass/Routing/RouteBuilder.php(83): Drupal\Core\Routing\RouteBuilder->rebuild()
> #37 /code/web/core/includes/common.inc(587): Drupal\Core\ProxyClass\Routing\RouteBuilder->rebuild()
> #38 /code/web/modules/contrib/captcha/captcha.post_update.php(12): drupal_flush_all_caches()
> #39 /code/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(321): captcha_post_update_refresh_captcha_helper_service(Array)
> #40 /code/vendor/drush/drush/includes/batch.inc(261): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate('captcha_post_up...', Object(DrushBatchContext))
> #41 /code/vendor/drush/drush/includes/batch.inc(206): _drush_batch_worker()
> #42 /code/vendor/drush/drush/includes/batch.inc(100): _drush_batch_command('5')
> #43 /code/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(175): drush_batch_command('5')
> #44 [internal function]: Drush\Commands\core\UpdateDBCommands->process('5', Array)
> #45 /code/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
> #46 /code/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #47 /code/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #48 /code/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #49 /code/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #50 /code/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #51 /code/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #52 /code/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #53 /code/vendor/drush/drush/src/Runtime/Runtime.php(118): Symfony\Component\Console\Application->run(Object(Drush\Symfony\DrushArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #54 /code/vendor/drush/drush/src/Runtime/Runtime.php(48): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #55 /code/vendor/drush/drush/drush.php(72): Drush\Runtime\Runtime->run(Array)
> #56 /code/vendor/drush/drush/drush(4): require('/code/vendor/dr...')
> #57 /code/vendor/bin/drush(120): include('/code/vendor/dr...')
> #58 {main}.
> [warning] Drush command terminated abnormally.
In ProcessBase.php line 171:
Unable to decode output into JSON: Syntax error
TypeError: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\S
ql\{closure}(): Argument #1 ($definition) must be of type Drupal\Core\Field
\FieldStorageDefinitionInterface, null given in Drupal\Core\Entity\Sql\Defa
ultTableMapping::Drupal\Core\Entity\Sql\{closure}() (line 175 of /code/web/
core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php).
[notice] Command: xxx-d9.dev -- drush updb [Exit: 1]
[error]

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

2.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mvnovick
  • πŸ‡ΊπŸ‡ΈUnited States taylormade415

    did anyone find a solution to this?

  • πŸ‡ΊπŸ‡ΈUnited States msangha

    I am having a similar issue. I have Drupal 10 installed on my local. I pull the Live DB which is Drupal 9 and run config import which works ok. When I run db updates via drush I get this error:

    >  [notice] Update started: media_post_update_oembed_loading_attribute
    >  [error]  TypeError: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}(): Argument #1 ($definition) must be of type Drupal\Core\Field\FieldStorageDefinitionInterface, null given in Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}() (line 175 of /var/www/mysite/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php) #0 [internal function]: Drupal\Core\Entity\Sql\DefaultTableMapping::Drupal\Core\Entity\Sql\{closure}()
    > #1 /var/www/mysite/core/lib/Drupal/Core/Entity/Sql/DefaultTableMapping.php(175): array_filter()
    > #2 /var/www/mysite/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(382): Drupal\Core\Entity\Sql\DefaultTableMapping::create()
    > #3 /var/www/mysite/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(357): Drupal\Core\Entity\Sql\SqlContentEntityStorage->getCustomTableMapping()
    > #4 /var/www/mysite/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(204): Drupal\Core\Entity\Sql\SqlContentEntityStorage->getTableMapping()
    > #5 /var/www/mysite/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(189): Drupal\Core\Entity\Sql\SqlContentEntityStorage->initTableLayout()
    > #6 /var/www/mysite/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(149): Drupal\Core\Entity\Sql\SqlContentEntityStorage->__construct()
    > #7 /var/www/mysite/modules/contrib/commerce/src/CommerceContentEntityStorage.php(28): Drupal\Core\Entity\Sql\SqlContentEntityStorage::createInstance()
    > #8 /var/www/mysite/modules/contrib/commerce/modules/product/src/ProductVariationStorage.php(35): Drupal\commerce\CommerceContentEntityStorage::createInstance()
    > #9 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityTypeManager.php(269): Drupal\commerce_product\ProductVariationStorage::createInstance()
    > #10 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityTypeManager.php(258): Drupal\Core\Entity\EntityTypeManager->createHandlerInstance()
    > #11 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityTypeManager.php(192): Drupal\Core\Entity\EntityTypeManager->getHandler()
    > #12 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityFieldManager.php(384): Drupal\Core\Entity\EntityTypeManager->getStorage()
    > #13 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityFieldManager.php(353): Drupal\Core\Entity\EntityFieldManager->buildBundleFieldDefinitions()
    > #14 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(413): Drupal\Core\Entity\EntityFieldManager->getFieldDefinitions()
    > #15 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(192): Drupal\Core\Entity\EntityDisplayBase->getFieldDefinitions()
    > #16 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityDisplayBase.php(153): Drupal\Core\Entity\EntityDisplayBase->init()
    > #17 /var/www/mysite/core/lib/Drupal/Core/Entity/Entity/EntityViewDisplay.php(178): Drupal\Core\Entity\EntityDisplayBase->__construct()
    > #18 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityStorageBase.php(418): Drupal\Core\Entity\Entity\EntityViewDisplay->__construct()
    > #19 /var/www/mysite/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(186): Drupal\Core\Entity\EntityStorageBase->mapFromStorageRecords()
    > #20 /var/www/mysite/core/lib/Drupal/Core/Entity/EntityStorageBase.php(312): Drupal\Core\Config\Entity\ConfigEntityStorage->doLoadMultiple()
    > #21 /var/www/mysite/core/lib/Drupal/Core/Config/Entity/ConfigEntityUpdater.php(136): Drupal\Core\Entity\EntityStorageBase->loadMultiple()
    > #22 /var/www/mysite/core/modules/media/media.post_update.php(32): Drupal\Core\Config\Entity\ConfigEntityUpdater->update()
    > #23 /var/www/mysite/vendor/drush/drush/src/Commands/core/UpdateDBCommands.php(280): media_post_update_oembed_loading_attribute()
    > #24 /var/www/mysite/vendor/drush/drush/includes/batch.inc(245): Drush\Commands\core\UpdateDBCommands::updateDoOnePostUpdate()
    > #25 /var/www/mysite/vendor/drush/drush/includes/batch.inc(192): _drush_batch_worker()
Production build 0.71.5 2024