Problem/Motivation
Attempting to apply the crm_simpsons recipe when crm is not already installed results in failure / error. Workaround is to enable crm before applying the crm_simpsons recipe, but this should not be necessary because the recipe depends on crm.
Steps to reproduce
git clone git@git.drupal.org:project/crm.git simpsonscd simpsonsddev config --project-type=drupal --docroot=web --php-version=8.4 --corepack-enable --project-name=simpsonsddev add-on get ddev/ddev-drupal-contribddev startddev poserddev symlink-projectddev drush site:install -y ../recipes/crm_simpsons(orddev drush site:install -y && ddev drush recipe ../recipes/crm_simpsons)
[ERROR] There were errors validating the config synchronization.
Unable to uninstall the CRM module because: There is content for the entity type:
Contact Method. Remove contact methods..
Unable to uninstall the CRM module because: There is content for the entity type:
Contact. Remove contacts..[error] Error: Call to a member function label() on null in Drupal\crm\Entity\Contact->preSave() (line 129 of /var/www/html/src/Entity/Contact.php) #0 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(567): Drupal\crm\Entity\Contact->preSave()
#1 /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(882): Drupal\Core\Entity\EntityStorageBase->doPreSave()
#2 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(522): Drupal\Core\Entity\ContentEntityStorageBase->doPreSave()
#3 /var/www/html/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php(804): Drupal\Core\Entity\EntityStorageBase->save()
#4 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php(370): Drupal\Core\Entity\Sql\SqlContentEntityStorage->save()
#5 /var/www/html/crm.install(61): Drupal\Core\Entity\EntityBase->save()
#6 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(829): crm_install()
#7 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(451): Drupal\Core\Extension\ModuleInstaller->invoke()
#8 /var/www/html/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(229): Drupal\Core\Extension\ModuleInstaller->doInstall()
#9 /var/www/html/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(83): Drupal\Core\Extension\ModuleInstaller->install()
#10 /var/www/html/web/core/lib/Drupal/Core/Recipe/RecipeRunner.php(275): Drupal\Core\ProxyClass\Extension\ModuleInstaller->install()
#11 [internal function]: Drupal\Core\Recipe\RecipeRunner::installModule()
#12 /var/www/html/web/core/lib/Drupal/Core/Recipe/RecipeCommand.php(99): call_user_func_array()
#13 /var/www/html/vendor/symfony/console/Command/Command.php(341): Drupal\Core\Recipe\RecipeCommand->execute()
#14 /var/www/html/vendor/symfony/console/Application.php(1102): Symfony\Component\Console\Command\Command->run()
#15 /var/www/html/vendor/drush/drush/src/Application.php(201): Symfony\Component\Console\Application->doRunCommand()
#16 /var/www/html/vendor/symfony/console/Application.php(356): Drush\Application->doRunCommand()
#17 /var/www/html/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun()
#18 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(113): Symfony\Component\Console\Application->run()
#19 /var/www/html/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun()
#20 /var/www/html/vendor/drush/drush/drush.php(140): Drush\Runtime\Runtime->run()
#21 /var/www/html/vendor/bin/drush.php(119): include('...')
#22 {main}.
Issue fork crm-3573023
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
Comment #3
bluegeek9 commentedComment #5
bluegeek9 commentedComment #8
jdleonardRecipe install is still failing.
Comment #9
bluegeek9 commentedComment #10
jdleonardNot at my computer, but I followed the steps to reproduce with
ddev drush site:install -y ../recipes/crm_simpsonsComment #11
jcandan commentedI experience this error from a fresh install, no recipe. Generate a vanilla database dump from a fresh standard install, then enable CRM, export config, drop the database, import the fresh-standard database, import config...boom, error.
Comment #12
jcandan commentedHaving acquired the dev branch with
ddev composer require drupal/crm:1.0.x-dev, this issue is resolved.@jdleonard, I hope you don't mind that I changed the scope of this issue away from being crm_simpsons-recipe focused. Being the error was generalized to config-import, it seemed fitting.
Could this new
FieldStorageConfigStorageerror warrant a new issue?Comment #13
bluegeek9 commentedComment #15
bluegeek9 commentedI was not able to reproduce the issue on the dev branch.
Comment #16
jdleonardddev composer config minimum-stability devcausesddev composer require drupal/crm drush/drushto install the latest release of stabilitydevor higher. At the time of writing this comment, that is1.0.0-beta4.What @jcandan is encountering has already been fixed in the 1.0.x branch, but no release has yet been made containing that fix. I verified this by:
ddev composer require drupal/crm:dev-1.0.x drush/drush, which requires the latest code from the 1.0.x branch (colloquially referred to as the "dev branch")The change in scope to an already fixed issue has made this issue too confusing to follow. I'm going to revert the issue title and description then follow up shortly on the
FieldStorageConfigStorageerror, which is related to the original scope.Comment #17
jdleonardComment #19
jdleonardPer Claude:
Running the install again, I now get the error:
Claude:
I verified the fix, which is in https://git.drupalcode.org/project/crm/-/merge_requests/199
This makes it possible to apply the recipe using
ddev drush site:install -y ../recipes/crm_simpsons(though it results in a pretty barren install as the recipe takes the place of the default "standard" recipe, but at least it doesn't error).An alternative approach would be for the recipe to only apply the config it strictly needs.
Comment #20
jdleonardFor completeness...
This is not working against 1.0.x:
The MR referenced in my previous comment addresses this.
Comment #22
bluegeek9 commentedThe issue looks to be a problem with recipes. You need to install crm before using the recipe.
We are not add comments are a dependency.
Comment #23
jdleonardI don't think there is evidence here of a problem with recipes in general. Recipes should be able to be installed via
drush site:installwithout erroring.Comments would only be a dependency of the sample data recipe, right? Not sure I see any problem with that.
The (theoretical) approach of only importing optional config that the recipe actually needs would resolve this issue without making the recipe dependent on comments. I have no objection to that approach.
Comment #26
bluegeek9 commentedI added the configs individually instead of a wildcard, and the erros does not occur.
Because the site is not installed first, there are no themes, or other items from the standard profile. Not a bug, but something to be aware of.
ddev drush site:install ../recipes/crm_simpsons -y