Problem/Motivation

Hi, I struggled with installing a new site based on existing config with drush si --existing-config, it fails with the message:

"Missing bundle entity, entity type block_content_type, entity id reusable_block."

After chasing this a bit I found that it is because gutenberg_install() tries to save a configuration entity before the reusable_block block content bundle exists in active configuration.

Steps to reproduce

drush si --existing-config -vvv will give a verbose output, eventually pointing to the .install file. Doing an early return in gutenberg_install and run the drush command again and you will see that it works.

Proposed resolution

TBD, but som guardrails or if possible avoiding to work on entities that might not exist in gutenberg_install()

CommentFileSizeAuthor
#5 3604139-drush-installing-from.patch863 bytesdkmishra

Issue fork gutenberg-3604139

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

vegardjo created an issue. See original summary.

vegardjo’s picture

Issue summary: View changes

dkmishra made their first commit to this issue’s fork.

dkmishra’s picture

Status: Active » Needs review
StatusFileSize
new863 bytes

Patch attached

vegardjo’s picture

Status: Needs review » Reviewed & tested by the community

Thx! Patch looks good to me, and I can confirm that site now installs successfully from config when patched.

szeidler’s picture

I'm wondering if this would be a proper check for such situations?

if (\Drupal::isConfigSyncing()) {
  return;
}

marcofernandes made their first commit to this issue’s fork.

marcofernandes’s picture

Thanks @szeidler, that's the right check. hook_install() already receives it as $is_syncing (the same flag as \Drupal::isConfigSyncing()), so I used that instead of checking for the reusable_block bundle.

function gutenberg_install($is_syncing) {
  // In a configuration import, like an installation from existing
  // configuration, modules are installed before their configuration entities
  // are imported, and the body field and its displays are imported with them.
  if ($is_syncing) {
    return;
  }

The same happened on the new submodule gutenberg_notes.

marcofernandes’s picture

Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.