- Issue created by @smulvih2
- 🇨🇦Canada smulvih2 Canada 🍁
Here is my exported media item:
{ "_links": { "type": { "href": "media\/image" }, "self": { "href": "_dcd\/media\/22" } }, "mid": [ { "value": 22 } ], "uuid": [ { "value": "07a67070-ca0f-48c1-a971-ac14397b9468" } ], "langcode": [ { "value": "fr", "lang": "fr" } ], "bundle": [ { "target_id": "image" } ], "revision_created": [ { "value": "2025-03-25T22:38:47+00:00", "format": "Y-m-d\\TH:i:sP" } ], "status": [ { "value": true, "lang": "fr" } ], "_embedded": { "relation\/media\/image\/uid": [ { "_links": { "type": { "href": "user\/user" }, "self": { "href": "_dcd\/user\/4" } }, "uuid": [ { "value": "13d57196-00c3-488b-afda-1b43fa6066df" } ], "lang": "fr" } ], "relation\/media\/image\/thumbnail": [ { "_links": { "type": { "href": "file\/file" }, "self": { "href": "_dcd\/file\/28" } }, "uuid": [ { "value": "c0c1c5fc-3a29-492b-b1b2-715f136d5aae" } ], "lang": "fr", "alt": null, "title": null, "width": "128", "height": "128" } ], "relation\/media\/image\/field_media_image": [ { "_links": { "type": { "href": "file\/file" }, "self": { "href": "_dcd\/file\/28" } }, "uuid": [ { "value": "c0c1c5fc-3a29-492b-b1b2-715f136d5aae" } ], "alt": null, "title": null, "width": "128", "height": "128" } ] }, "name": [ { "value": "icon-subject-17.png", "lang": "fr" } ], "created": [ { "value": "2025-03-25T22:38:47+00:00", "lang": "fr", "format": "Y-m-d\\TH:i:sP" } ], "changed": [ { "value": "2025-03-25T22:38:47+00:00", "lang": "fr", "format": "Y-m-d\\TH:i:sP" } ], "default_langcode": [ { "value": true, "lang": "fr" } ], "revision_translation_affected": [ { "value": true, "lang": "fr" } ], "metatag": [ { "value": { "canonical_url": "http:\/\/default\/fr\/bienvenue", "dcterms_language": "fr" } } ], "path": [ { "alias": "\/media\/image\/22", "pid": 1457, "langcode": "fr", "lang": "fr" } ], "content_translation_source": [ { "value": "und", "lang": "fr" } ], "content_translation_outdated": [ { "value": false, "lang": "fr" } ], "field_media_in_library": [ { "value": true } ], "_dcd_metadata": { "export_timestamp": 1744399835 } }
Comparing this against another project using an older DCD version, this is missing items from
_links
, specificallyuid
,thumbnail
andimage
. - 🇨🇦Canada smulvih2 Canada 🍁
So from the JSON code above, it's missing this outside of _embedded:
"field_media_image": [ { "uuid": "c0c1c5fc-3a29-492b-b1b2-715f136d5aae", "lang": "en" } ], "field_media_image": [ { "uuid": "c0c1c5fc-3a29-492b-b1b2-715f136d5aae", "lang": "fr" } ],
The patch attached gets media items importing for me, although not a real solution, just to show what is needed for the fix to
$data
. - 🇨🇦Canada smulvih2 Canada 🍁
Hmmm not sure actually, looks like with 2.1.x the field_media_image is actually under
_links
and not as it's own root-level array. Not sure the proper approach here. - 🇨🇦Canada smulvih2 Canada 🍁
So after looing at this in more detail, seems to be an export issue, not import. The export is missing the _links to the embedded content.
- 🇩🇪Germany mkalkbrenner 🇩🇪
The format changed. Most of _links at top level is not need for our use-case.
So from the JSON code above, it's missing this outside of _embedded:
No, this is correct. Entity Reference fields are only in _embedded.
It seems to be an import related issue.
-
mkalkbrenner →
committed 44a7eaca on 2.2.x
Issue #3519163 by smulvih2, mkalkbrenner: Issue with media entity export
-
mkalkbrenner →
committed 44a7eaca on 2.2.x
- 🇩🇪Germany mkalkbrenner 🇩🇪
I was able to reproduce the issue if a module is installed that reacts to media entity updates. In our case, image_replace isn't fault tolerant. So default_content_deploy can't import the entity or fix the file ID later.
A quick fix is to handle files at the beginning of the import.
BTW that issue was hidden in previous versions. Meaning, it existed as well but didn't hurt because of the more verbose export format.