A custom block is made of two entities, one for the placement and one for the actual content. Only the actual placement can be exported with cim. The content can not. Therefore this will result in "Block description Broken/Missing" error on site where the config is imported. And since there is no option to disable custom blocks from being exported through Configuration management, this will break the functionality.
Steps to reproduce
On Site A:
Create custom block
Assign this custom block to any region
Export configuration of the site
On Site B:
Import configuration from site A
Go to Block layout and you will see custom block in correctly assigned region, however block won't work or actually show anything.
Edit that block, you will see this messages:
Block description Broken/Missing
This block is broken or missing. You may be missing content or you might need to enable the original module.
Go under Custom block library and you won't see custom block.
Block layout got exported but block content didn't resulting in broken relationship.
In the above image a drupal block named “Block Content test” is added in content region in a local instance.
The above image shows that the block is missing after importing configuration using Drush command “drush cim”.
Way 1: Using Database Sync
Create Custom Block in Site B.
Replace db of Site A with Site B using drush sql-sync
Now the block is available in Site A. So will place it in a region.
Use drush cex to export config and commit to Site B.
Use drush cim in Site B and the block will be placed in the region.
Way 2: Use Drupal drush functions to export config and hook_update_n & block uuid to update content.
Create block B4 Test in Site A.
Place the block in some region.
Export using drush cex.
Commit and run drush cim in site B
Block error will be shown in Site B
Write hook_update_n and commit. Take Update in Site B and run update.php in Site B to add the block.
Check Site B if the block is placed or not.
We have used Drush Commands “drush cex” to export block configurations and “drush cim” to import the configurations.
So Once drush cim is done in site B write a hook_update_N in your custom module's .install file use the block uuid to update the database of Site B.
After running update.php the block will be placed in the region
The first method can be used where the database size is less as it will take less time to sync the database. The 2nd method can be used where the database size is huge.
Depending on the scenario we can use any one of the methods. In this blog I have explained the two methods which we can use for updating blocks from one environment to another.