- Issue created by @ashetkar
- 🇮🇳India adarshv
Hi @ ashetkar, I've tried to reproduce the issue but I'm not getting the error.
- 🇺🇸United States cilefen
How does the import configuration differ from the running configuration? Why are you importing configuration after upgrading? You should be exporting.
- 🇮🇳India ashetkar
When we commit code and send to server at server end import config is getting failed for existing configuration. I have exported configuration but there is no change for base_field_override related config.
- 🇺🇸United States cilefen
How does the import configuration differ from the running configuration on the server end?
- 🇮🇳India ashetkar
How does the import configuration differ from the running configuration on the server end? - No it's not different all config starts base_field_override is getting failed. Please find below one of the config name : core.base_field_override.node.page.promote.yml
uuid: 69be9e46-6806-4c5d-83c7-bf3312538678
langcode: en
status: true
dependencies:
config:
- node.type.page
_core:
default_config_hash: vdYkuvvyzCU3dFiOu7LULd-uZyENb_byNYidQVIZtXk
id: node.page.promote
field_name: promote
entity_type: node
bundle: page
label: 'Promoted to front page'
description: ''
required: false
translatable: false
default_value:
-
value: 0
default_value_callback: ''
settings:
on_label: 'On'
off_label: 'Off'
field_type: boolean - Status changed to Postponed: needs info
5 months ago 3:21pm 19 April 2024 - 🇺🇸United States cilefen
In what way does the import configuration differ from the running configuration? You can see the diff at the configuration sync UI.
It looks like the field storage definition is missing.
- 🇮🇳India ashetkar
Promote is not field it is an attribute. We are overriding default promote attribute in field override.
- 🇪🇬Egypt Euclid.H
The error suggests an issue with the promote field configuration for the node content type during configuration import.
Drupal compares file-based configuration with database-stored configuration during import, updating the latter if necessary. The error indicates a problem with the promote field's configuration, likely due to improper loading.After upgrading Drupal core or modules, you may need to import configuration to update the configuration stored in the database to match the new codebase.
This is why you're performing a configuration import after upgrading - 🇮🇳India ashetkar
I have compared drupal core (core/lib/Drupal/Core/Field/) FieldConfigBase.php file for version 10.1.8 and 10.2.5. I can see the below difference in code.
// Make sure all expected runtime settings are present.
$default_settings = \Drupal::service('plugin.manager.field.field_type')
->getDefaultFieldSettings($this->getType());
// Filter out any unknown (unsupported) settings.
$supported_settings = array_intersect_key($this->getSettings(), $default_settings);
$this->set('settings', $supported_settings + $default_settings);https://git.drupalcode.org/project/drupal/-/blob/10.1.8/core/lib/Drupal/...
https://git.drupalcode.org/project/drupal/-/blob/10.2.5/core/lib/Drupal/...Above code added newly in 10.2.5 version which is not allowing import for base_field_override fields. I have added patch where i removed above code.
- 🇧🇪Belgium wanjee
Got the same error message on full (re)install after applying an update of Drupal from 10.1 to 10.2.6.
On a perfectly fine environment I applied composer update, executed drush updb then exported the config.
Then when I try to reinstall the project using `drush -y site-install minimal --site-name="Test" --account-name=admin --account-pass=password --config-dir="../config/sync"` I got the error mentioned above after "install_bootstrap_full" task.
The issue does not show on install when the patch proposed by ashetkar in #11 is applied.
(Reinstall using that command is part of our workflow to facilitate life of all developers working on the project)
After this clean install if I run drush cex I don't see any config change so I don't fix this is related to incorrect configuration management in the project.
The error I got was related to config core.base_field_override.node.ad_group.moderation_state.yml
- 🇧🇾Belarus gun_dose
I had the same error on
drush si
command. Patch from #11 fixed the problem - 🇭🇺Hungary mxr576 Hungary
The mentioned commit in #11 is with us since 10.2.0, We have also bumped a similar failure that was reported in this issue.
https://git.drupalcode.org/project/drupal/-/commit/e878713656faabf6d3afd... - 🇭🇺Hungary mxr576 Hungary
Those who are also suffering from this problem, do you also have Content Moderation module enabled on your projects?
I enabled debug logging and I see a bunch of complains related to the moderation_state field, and for that field only.
Unexpected error during import with operation create for core.base_field_override.node.[node_type].moderation_state: moderation_state []
- 🇭🇺Hungary mxr576 Hungary
Made this change and due to Monolog being active on the project since site install, I could capture this backtrace without spending hours on waiting for xDebug... not sure if it helps.
diff --git a/core/lib/Drupal/Core/Field/FieldConfigBase.php b/core/lib/Drupal/Core/Field/FieldConfigBase.php --- a/core/lib/Drupal/Core/Field/FieldConfigBase.php +++ b/core/lib/Drupal/Core/Field/FieldConfigBase.php @@ -369,6 +369,11 @@ * {@inheritdoc} */ public function getSettings() { + if ($this->getFieldStorageDefinition() === NULL) { + $e = new \Exception(); + \Drupal::logger(__CLASS__)->error('Fetching field storage definitions could not be fetched for "%name". Stack trace: <pre>%debug</pre>', ['%name' => $this->getName() , '%debug' => $e->getTraceAsString()]); + return $this->settings; + } return $this->settings + $this->getFieldStorageDefinition()->getSettings(); }
[19-Jun-2024 08:19:33 UTC] [2024-06-19T08:19:33.215289+00:00] Drupal\Core\Field\FieldConfigBase.ERROR: Fetching field storage definitions failed for "moderation_state". Stack trace: <pre>#0 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Field/FieldConfigBase.php(287): Drupal\Core\Field\FieldConfigBase->getSettings() #1 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(430): Drupal\Core\Field\FieldConfigBase->postCreate() #2 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(357): Drupal\Core\Config\Entity\ConfigEntityStorage->_doCreateFromStorageRecord() #3 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(1059): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate() #4 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(842): Drupal\Core\Config\ConfigImporter->importInvokeOwner() #5 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(663): Drupal\Core\Config\ConfigImporter->processConfiguration() #6 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(561): Drupal\Core\Config\ConfigImporter->processConfigurations() #7 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/Importer/ConfigImporterBatch.php(31): Drupal\Core\Config\ConfigImporter->doSyncStep() #8 /mnt/files/local_mount/build/web/core/includes/batch.inc(296): Drupal\Core\Config\Importer\ConfigImporterBatch::process() #9 /mnt/files/local_mount/build/web/core/includes/form.inc(973): _batch_process() #10 /mnt/files/local_mount/build/web/core/includes/install.core.inc(660): batch_process() #11 /mnt/files/local_mount/build/web/core/includes/install.core.inc(578): install_run_task() #12 /mnt/files/local_mount/build/web/core/includes/install.core.inc(121): install_run_tasks() #13 /mnt/files/local_mount/build/vendor/drush/drush/includes/drush.inc(69): install_drupal() #14 /mnt/files/local_mount/build/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array() #15 /mnt/files/local_mount/build/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(167): drush_op() #16 [internal function]: Drush\Commands\core\SiteInstallCommands->install() #17 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array() #18 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() #19 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() #20 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process() #21 /mnt/files/local_mount/build/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute() #22 /mnt/files/local_mount/build/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run() #23 /mnt/files/local_mount/build/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #24 /mnt/files/local_mount/build/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #25 /mnt/files/local_mount/build/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run() #26 /mnt/files/local_mount/build/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun() #27 /mnt/files/local_mount/build/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run() #28 /mnt/files/local_mount/build/vendor/drush/drush/drush(4): require('...') #29 /mnt/files/local_mount/build/vendor/bin/drush(119): include('...') #30 {main}</pre> [] {"referer":"","ip":"127.0.0.1","request_uri":"http://default/","uid":0,"user":""}
- Status changed to Needs work
3 months ago 8:43am 19 June 2024 - 🇭🇺Hungary mxr576 Hungary
Hiding patch because it is not a solution, just a hack.
- 🇫🇮Finland lauriii Finland
Thank you for posting the manual steps to reproduce this! A test case that consistently reproduces this would be really helpful as a potential next step.
- Merge request !8456Draft: Issue #3447198 by phenaproxima, alexpott, nicxvan, larowlan: RecipeCommand... → (Open) created by mxr576
- 🇭🇺Hungary mxr576 Hungary
I tried to put together repro steps by using a clean Drupal 10.2.7 install and with content moderation enabled, but I could not.
I did updated the issue description and I would have questions to @ashetkar:
- You wrote in the issue description: "I do config import I am getting issue for field core.base_field_override.node.content_type_name.promote as below " and later further clarified in comment 5. So based on those, am I correct that you see this failure NOT on a clean site install from existing config but when
drush cim -y
runs on an existing project? - Are you sure that the issue was related to the promote base field and not moderation_state?
- You wrote in the issue description: "I do config import I am getting issue for field core.base_field_override.node.content_type_name.promote as below " and later further clarified in comment 5. So based on those, am I correct that you see this failure NOT on a clean site install from existing config but when
- 🇭🇺Hungary mxr576 Hungary
I tried different base fields, the UID or the Promoted field on the Article content type, but I could only reproduce the issue by changing the Moderation State field. Proof:
$ vendor/bin/drush cex --diff [notice] Differences of the active config to the export directory: diff --git a/tmp/drush_tmp_1718824442_66732dfa7326c/core.base_field_override.node.article.moderation_state.yml b/tmp/drush_tmp_1718824442_66732dfa7326c/core.base_field_override.node.article.moderation_state.yml new file mode 100644 index 00000000..8f89408d --- /dev/null +++ b/tmp/drush_tmp_1718824442_66732dfa7326c/core.base_field_override.node.article.moderation_state.yml @@ -0,0 +1,18 @@ +uuid: 5689d78d-eb8f-4d3b-a1d2-361aff2b3504 +langcode: en +status: true +dependencies: + config: + - node.type.article +id: node.article.moderation_state +field_name: moderation_state +entity_type: node +bundle: article +label: Foo +description: 'The moderation state of this piece of content.' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: string The .yml files in your export directory (/mnt/files/local_mount/build/config/sync) will be deleted and replaced with the active config. (yes/no) [yes]: > [success] Configuration successfully exported to /mnt/files/local_mount/build/config/sync. /mnt/files/local_mount/build/config/sync $ vendor/bin/drush si -y --existing-config You are about to: * DROP all tables in your 'drupal' database. // Do you want to continue?: yes. [notice] Starting Drupal installation. This takes a while. [notice] Performed install task: install_select_language [notice] Performed install task: install_select_profile [notice] Performed install task: install_load_profile [notice] Performed install task: install_verify_requirements [notice] Performed install task: install_verify_database_ready [notice] Performed install task: install_base_system [notice] Performed install task: install_bootstrap_full [warning] Undefined array key "moderation_state" BaseFieldOverride.php:180 [error] Error: Call to a member function getFieldStorageDefinition() on null in Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition() (line 120 of /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php) #0 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Field/FieldConfigBase.php(370): Drupal\Core\Field\Entity\BaseFieldOverride->getFieldStorageDefinition() #1 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Field/FieldConfigBase.php(287): Drupal\Core\Field\FieldConfigBase->getSettings() #2 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(430): Drupal\Core\Field\FieldConfigBase->postCreate() #3 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(357): Drupal\Core\Config\Entity\ConfigEntityStorage->_doCreateFromStorageRecord() #4 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(1059): Drupal\Core\Config\Entity\ConfigEntityStorage->importCreate() #5 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(842): Drupal\Core\Config\ConfigImporter->importInvokeOwner() #6 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(663): Drupal\Core\Config\ConfigImporter->processConfiguration() #7 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/ConfigImporter.php(561): Drupal\Core\Config\ConfigImporter->processConfigurations() #8 /mnt/files/local_mount/build/web/core/lib/Drupal/Core/Config/Importer/ConfigImporterBatch.php(31): Drupal\Core\Config\ConfigImporter->doSyncStep() #9 /mnt/files/local_mount/build/web/core/includes/batch.inc(296): Drupal\Core\Config\Importer\ConfigImporterBatch::process() #10 /mnt/files/local_mount/build/web/core/includes/form.inc(973): _batch_process() #11 /mnt/files/local_mount/build/web/core/includes/install.core.inc(660): batch_process() #12 /mnt/files/local_mount/build/web/core/includes/install.core.inc(578): install_run_task() #13 /mnt/files/local_mount/build/web/core/includes/install.core.inc(121): install_run_tasks() #14 /mnt/files/local_mount/build/vendor/drush/drush/includes/drush.inc(69): install_drupal() #15 /mnt/files/local_mount/build/vendor/drush/drush/includes/drush.inc(53): drush_call_user_func_array() #16 /mnt/files/local_mount/build/vendor/drush/drush/src/Commands/core/SiteInstallCommands.php(167): drush_op() #17 [internal function]: Drush\Commands\core\SiteInstallCommands->install() #18 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array() #19 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback() #20 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter() #21 /mnt/files/local_mount/build/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(391): Consolidation\AnnotatedCommand\CommandProcessor->process() #22 /mnt/files/local_mount/build/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute() #23 /mnt/files/local_mount/build/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run() #24 /mnt/files/local_mount/build/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand() #25 /mnt/files/local_mount/build/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun() #26 /mnt/files/local_mount/build/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run() #27 /mnt/files/local_mount/build/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun() #28 /mnt/files/local_mount/build/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run() #29 /mnt/files/local_mount/build/vendor/drush/drush/drush(4): require('...') #30 /mnt/files/local_mount/build/vendor/bin/drush(119): include('...') #31 {main}.
I also could not reproduce the problem by importing a base field override via config import to an existing side (as @ashetkar's report indicated that). Proof:
$ vendor/bin/drush cex --diff [notice] Differences of the active config to the export directory: diff --git a/tmp/drush_tmp_1718825233_6673311143395/core.base_field_override.node.article.moderation_state.yml b/tmp/drush_tmp_1718825233_6673311143395/core.base_field_override.node.article.moderation_state.yml new file mode 100644 index 00000000..cc25bbf8 --- /dev/null +++ b/tmp/drush_tmp_1718825233_6673311143395/core.base_field_override.node.article.moderation_state.yml @@ -0,0 +1,18 @@ +uuid: 9b164680-9812-452b-9b14-2507cc482d5f +langcode: en +status: true +dependencies: + config: + - node.type.article +id: node.article.moderation_state +field_name: moderation_state +entity_type: node +bundle: article +label: Foo +description: 'The moderation state of this piece of content.' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: string The .yml files in your export directory (/mnt/files/local_mount/build/config/sync) will be deleted and replaced with the active config. (yes/no) [yes]: > [success] Configuration successfully exported to /mnt/files/local_mount/build/config/sync. /mnt/files/local_mount/build/config/sync $ vendor/bin/drush cdel core.base_field_override.node.article.moderation_state $ vendor/bin/drush cim --diff diff --git a/tmp/drush_tmp_1718825254_66733126f2c77/core.base_field_override.node.article.moderation_state.yml b/tmp/drush_tmp_1718825254_66733126f2c77/core.base_field_override.node.article.moderation_state.yml new file mode 100644 index 00000000..cc25bbf8 --- /dev/null +++ b/tmp/drush_tmp_1718825254_66733126f2c77/core.base_field_override.node.article.moderation_state.yml @@ -0,0 +1,18 @@ +uuid: 9b164680-9812-452b-9b14-2507cc482d5f +langcode: en +status: true +dependencies: + config: + - node.type.article +id: node.article.moderation_state +field_name: moderation_state +entity_type: node +bundle: article +label: Foo +description: 'The moderation state of this piece of content.' +required: false +translatable: true +default_value: { } +default_value_callback: '' +settings: { } +field_type: string Import the listed configuration changes? (yes/no) [yes]: > [notice] Synchronized configuration: create core.base_field_override.node.article.moderation_state. [notice] Finalizing configuration synchronization. [success] The configuration was imported successfully.
- 🇩🇪Germany sunlix Wesel
Hey,
we have the same behavior in our installations. New installation with
drush site:install --existing-config
are not successfull if we have a content type configured to acontent_moderation
workflow.
Beside this patch we have to apply the path from 🐛 BaseFieldOverride fails to take into account ContentEntityInterface::bundleFieldDefinitions() when invoking onFieldDefinitionUpdate() Needs work to be able to successfull install from existing config.
Maybe that could related to each other. The error message differs but I think it is some kind of the same source issue. - 🇳🇿New Zealand quietone New Zealand
Fixes are made on on 11.x (our main development branch) first, and are then back ported as needed according to our policies.