- Issue created by @Liam Morland
- πΊπΈUnited States thejimbirch Cape Cod, Massachusetts
What was the config file you imported?
And what did that config file look like when you exported it after recipe application?
This is most likely invalid configuration. Recipes validation is very strict and can often find invalid config, even when core does not.
- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
I observed the problem with dozens of config files generated by
drush config-export
. In some cases, the only difference in the config files is the value ofdefault_config_hash
. - πΊπΈUnited States thejimbirch Cape Cod, Massachusetts
Can you please provide specific examples?
- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
We are experimenting with a recipe that installs
focal_point
. The recipe contains this asconfig/crop.type.focal_point.yml
:uuid: 1c7db39b-83ff-426c-a193-e247cd89027b langcode: en status: true dependencies: { } _core: default_config_hash: flCi9IdafdLXlJqvoHguutUOiC05-aynK4niYN4YZ3o id: focal_point label: 'Focal point' description: 'Crop type used by Focal point module.' aspect_ratio: '' soft_limit_width: null soft_limit_height: null hard_limit_width: null hard_limit_height: null
After applying the recipe and running, drush config-export, the following
crop.type.focal_point.yml
file exists in the config sync directory:uuid: 1c7db39b-83ff-426c-a193-e247cd89027b langcode: en status: true dependencies: { } _core: default_config_hash: DufXX5yd2xSMN-A2aikottVXv2CaBUYzt5kW6m5EXvg id: focal_point label: 'Focal point' description: 'Crop type used by Focal point module.' aspect_ratio: '' soft_limit_width: null soft_limit_height: null hard_limit_width: null hard_limit_height: null
The only difference between these is the value of
default_config_hash
.If I try to run the recipe again, it says:
The configuration 'crop.type.focal_point' exists already and does not match the recipe's configuration
- πΊπΈUnited States thejimbirch Cape Cod, Massachusetts
ok! Config in the config folder is strict. It is the similar to if you were to try to install a module and the config/install/crop.type.focal_point.yml already existed the module installation would fail.
Just merged into Drupal 10.4, you can set strict to false, and it will skip passed it.
config: strict: false
Some other notes:
- You don't need to copy paste config that are provided by modules into your config folder. That config comes from the focal point module, you should import that from the module.
- When you do put config in your config folder, you should remove the UUID and _core: default_config_hash:
- π¨π¦Canada Liam Morland Ontario, CA π¨π¦
I don't want it to skip past that config. The point of applying the recipe is to make the site be configured the way the recipe calls for. If it skips past, it the recipe will say it was applied when it was not, at least in any useful sense.
I gave
crop.type.focal_point
as an example. There were other files that exhibit this problem which are not the default config of any module.It would be helpful if there was some kind of recipe validator or warning message so that developers know to remove
uuid
and_core: default_config_hash
from the config.But even if those keys are there, they should not be included in the config comparison. This issue is about removing unnecessary comparisons which result in Drupal falsely raising the "exists already and does not match" error.