Dependencies to file entities are missing

Created on 23 May 2025, 15 days ago

Problem/Motivation

When syncing content between multiple environments, importing media causes issues due to missing file dependencies within the export files.

>  [notice] Imported content jeroen.meeus (user: 926). In EntityReferenceFieldItemNormalizer.php line 84:           
>  No "file" entity found with UUID "876e1428-4967-4a58-a015-384b0e9cc296" for field "0". 

Steps to reproduce

  • Setup 2 identical Drupal websites. with "Media" enabled.
  • Create a node with a reference to an image
  • Export all nodes using Drush
  • Copy the export to the 2nd website
  • Import the content

Used commands:
drush content-sync:export --entity-types=node.structured_content --include-dependencies --files=folder
drush content-sync:import --entity-types=node.structured_content --actions=create,update

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇧🇪Belgium yoerioptr

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

Comments & Activities

  • Issue created by @yoerioptr
  • 🇧🇪Belgium yoerioptr

    I've created a patch that checks if the normalizer has missed any dependencies and adds them if necessary. This might not be the ideal solution as Drupal core should handle this, but this was the least invasive solution.

Production build 0.71.5 2024