Problem during import

Created on 15 March 2023, almost 2 years ago
Updated 17 March 2023, almost 2 years ago

Problem/Motivation

In one of your helpful videos, you mentioned that the content type should continue to work if the Schema.org Blueprints collection of modules are turned off. Does this includes exporting and importing (using drush cex/cim) to a new site without Schema.org Blueprints & its submodules?

I was able to successfully export but when i tried to import, i've been getting an error. This error points to "moderation_state". I do have the core Moderation Content module enabled but had no problem with export and import of another Drupal site that has the module but not using Schema.org Blueprints. So i'm wondering if there is a conflict or known problem between your module and the other one? Here's the importing error:

[warning] Undefined array key "moderation_state" BaseFieldOverride.php:165
[error] TypeError: Drupal\Core\Entity\ContentEntityStorageBase::onFieldDefinitionUpdate(): Argument #2 ($original) must be of type Drupal\Core\Field\FieldDefinitionInterface, null given, called in /var/www/html/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php on line 205 in Drupal\Core\Entity\ContentEntityStorageBase->onFieldDefinitionUpdate() (line 549 of /var/www/html/web/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php) #0 /var/www/html/web/core/lib/Drupal/Core/Field/Entity/BaseFieldOverride.php(205): Drupal\Core\Entity\ContentEntityStorageBase->onFieldDefinitionUpdate(Object(Drupal\Core\Field\Entity\BaseFieldOverride), NULL)
#1 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(562): Drupal\Core\Field\Entity\BaseFieldOverride->preSave(Object(Drupal\Core\Field\BaseFieldOverrideStorage))
#2 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityStorageBase.php(517): Drupal\Core\Entity\EntityStorageBase->doPreSave(Object(Drupal\Core\Field\Entity\BaseFieldOverride))
#3 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(253): Drupal\Core\Entity\EntityStorageBase->save(Object(Drupal\Core\Field\Entity\BaseFieldOverride))
#4 /var/www/html/web/core/lib/Drupal/Core/Entity/EntityBase.php(339): Drupal\Core\Config\Entity\ConfigEntityStorage->save(Object(Drupal\Core\Field\Entity\BaseFieldOverride))
#5 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityBase.php(608): Drupal\Core\Entity\EntityBase->save()
#6 /var/www/html/web/core/lib/Drupal/Core/Config/Entity/ConfigEntityStorage.php(354): Drupal\Core\Config\Entity\ConfigEntityBase->save()
[...]

I have tried the following:

  1. Remove my custom author field & module
  2. Disable Schema.org Blueprints Content Moderation
  3. Remove the core Content Moderation states & module

Steps to reproduce

  1. I created a new Drupal site 9.5.3
  2. Installed the Schema.org Blueprints module and enabled it along with some of the submodules
  3. Created a publication content type with some mapped Schema.org fields from CreativeWork, some simple Drupal fields (eg date, text, boolean) and a custom author field (i did use the blueprints modules to create this custom field)
  4. Exported the site's configuration using drush cex
  5. Tried to import the configuration using drush cim and got the above error

Your help is appreciated...maybe even suggestions on how to debug this problem?

πŸ’¬ Support request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @monaw
  • Status changed to Postponed: needs info almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    Some aspects of the Schema.org Blueprints module must be enabled on the site to support things like JSON-LD.

    I am guessing you are facing a config export/import issue between your environments.

    I am able to execute the below steps without any problems

    • drush schemadotorg:set-setup common
    • drush config-export
    • # Make some changes
    • drush config-import
  • thanks Jacob for your confirmation that the import should work! some followup questions/info:

    1. the error doesn't suggest JSON-LD but perhaps i have missed something?
    2. both my source and destination environments are pretty much stock Drupal 9.5.3 using ddev...just the minimum to explore and test this module's functionalities; only extra modules i installed are Devel, JSON API Extras, and Metatag
    3. please elaborate more about the " schemadotorg:set-setup Setup the Schema.org mapping set. (soss)" command you used?
    4. for the test you did above, does the destination site have or not have the Schema.org Blueprints modules?
    5. for your test above, did your content type have custom fields or any field over-rides?

    thanks!

  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    The destination should have the same modules downloaded.

    To use the Schema.org Blueprints module to create some generic reusable configuration, you will need to have a decent understanding of Drupal's configuration management system.

    The `drush schemadotorg:set-setup common` command generates multiple related Schema.org types in sequence.

    1. yes, the destination drupal had the same modules, except no Blueprints modules (since that's what i'm testing)
    2. so just to be sure i understand, when you did your test outline in comment #2 above, the destination drupal site HAS the Blueprints modules and they are enabled?
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY

    I think the Schema.org Blueprints module needs to be installed because of the mappings.

  • ok, thanks again Jacob for all your support! i am going to recommend that we do use this module, just wanted to understand the limitations (: you can go ahead and close this issue

  • Status changed to Closed: outdated almost 2 years ago
  • πŸ‡ΊπŸ‡ΈUnited States jrockowitz Brooklyn, NY
Production build 0.71.5 2024