3

After synchronizing configuration from dev to staging, I would expect all changes to be imported and for a message to display, advising "There are no configuration changes to import"

Most changes have been imported but I am left with six items which seemed to have failed import. Or a least do not clear from the list of items for import.

I do not understand why the active configuration appears not be be updated by staged.

As well importing all, I have also attempted to import each item separately, without success.

As well as using the UI have also tried drush cim. Drush confirms that the configuration was imported successfully. But if I run drush cim again, the same 6 files remain.

Why does it appear that the import is failing and what should I do to fix it? Is my active configuration messed up somehow?

A screenshot and some code to illustrate the problem.

Via the UI

configuration items not imported

Via Drush

    [easable]:sync$ drush cim
    +------------+-----------------------------------------------------+-----------+
    | Collection | Config                                              | Operation |
    +------------+-----------------------------------------------------+-----------+
    |            | block.block.schoolpwa_subtheme_bottommenu           | Update    |
    |            | block.block.schoolpwa_subtheme_mainnavigation       | Update    |
    |            | block.block.mainmenu2                               | Update    |
    |            | block.block.websiteswitcher                         | Update    |
    |            | core.entity_view_display.node.page.default          | Update    |
    |            | media_bulk_upload.media_bulk_config.pdf_bulk_upload | Update    |
    +------------+-----------------------------------------------------+-----------+

     Import the listed configuration changes? (yes/no) [yes]:
     >

     [notice] Synchronized configuration: update block.block.schoolpwa_subtheme_bottommenu.
     [notice] Synchronized configuration: update block.block.schoolpwa_subtheme_mainnavigation.
     [notice] Synchronized configuration: update block.block.mainmenu2.
     [notice] Synchronized configuration: update block.block.websiteswitcher.
     [notice] Synchronized configuration: update core.entity_view_display.node.page.default.
     [notice] Synchronized configuration: update media_bulk_upload.media_bulk_config.pdf_bulk_upload.
     [notice] Finalizing configuration synchronization.
     [success] The configuration was imported successfully.
    [easable]:sync$ drush cim
    +------------+-----------------------------------------------------+-----------+
    | Collection | Config                                              | Operation |
    +------------+-----------------------------------------------------+-----------+
    |            | block.block.schoolpwa_subtheme_bottommenu           | Update    |
    |            | block.block.schoolpwa_subtheme_mainnavigation       | Update    |
    |            | block.block.mainmenu2                               | Update    |
    |            | block.block.websiteswitcher                         | Update    |
    |            | core.entity_view_display.node.page.default          | Update    |
    |            | media_bulk_upload.media_bulk_config.pdf_bulk_upload | Update    |
    +------------+-----------------------------------------------------+-----------+

     Import the listed configuration changes? (yes/no) [yes]:
     >
2

1 Answer 1

3

I've found that this sort of thing is because the config in your sync directory is not quite legitimate. My guess is that this is an issue on your dev and local environments too, not just staging.

I've found that the cause of this issue is usually a result of one of two things:

1. Configuration files were manipulated manually and the configuration in the file isn't possible.

An example, looking at your pastebin, the change for core.entity_view_display.node.page.default.yml is to remove the created field from the list of hidden fields on that display. However, there's no configuration for how the field should be displayed. A field can't be not displayed and also not hidden. To maintain the integrity of the config, the system defaults a field to hidden when it's not in either place.

2. Database updates were run, updates that change configuration, but configuration was not exported on the dev environment after the update.

An example, looking at your pastebin, it looks like some new configuration options (with appropriate default values) were added. It also looks like a module changed from working with true and false to 1 and 0.

To resolve this issue:

First go to your primary development environment. Then get your latest database of record, clear cache, and deploy (database updates, then import your configuration). The result should be the same thing you're seeing on staging, i.e. some configuration will appear to be not fully synced. This is expected (for the reasons described above). Next re-export your configuration, commit, and re-deploy.

To avoid this issue in the future:

  1. Don't manipulate config files directly. If you do, test the configuration locally to make sure you got it right (this includes after resolving merge conflicts in config files).
  2. Always export configuration after running database updates. Sometimes the updates change configuration.
3
  • 2
    I'd probably fix this by getting the latest live DB (sanitized if necessary) and import this on all other environments and restart from there, with my local site first: updb cim cc and then configuration:export and see what comes out of it. Then deploy that to dev, drush deploy. All fine? Then to stage, drush deploy. All fine? Release and then drush deploy to live again.
    – leymannx
    Commented Aug 17, 2020 at 13:50
  • Thank you both for pointing me in the right direction. I have narrowed most of the problems down to a deprecation in menu_block module. drupal.org/project/menu_block/issues/3133567 Commented Aug 17, 2020 at 14:47
  • I had obviously not updated the db properly after updating the module. Commented Aug 17, 2020 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.