I run the drush migrate-duplicate-file-detection migd8_grants_media_step1 successfully, and then run the node migration and step 1, however the media is being populated with the name only, the file is not attached nor are the files being moved over to the sites default/files/grants directory as they should Steps to reproduce

this is my step 1 yml.

# File to Media Migration configuration for grants Media migration

id: migd8_grants_media_step1
label: Grants Media Step 1
migration_group: cncs
  key: migrate
  plugin: media_entity_generator_d7
  entity_type: node
  bundle: grants
  langcode: und
  d7_file_url: 'https://www.externalwebsite/sites/default/files/'
  - field_files

  plugin: entity:media


    plugin: default_value
    default_value: document

# Using the alt tag if available, else the file name.
    plugin: media_name
    source: file_name

# This process plugin will skip the whole row if a existing media is found.
    plugin: check_media_duplicate
    source: target_id

# This process plugin will skip the whole row if a duplicate document is found.
    plugin: check_duplicate
    source: target_id

# Map the field
field_media_document/target_id: target_id
  plugin: media_file_copy
  move: FALSE
  reuse: TRUE
  path: 'public://grants/'
  source: file_path

langcode: und

  plugin: default_value
  default_value: 1
  • 4
    You might want to edit to format the code exactly as your current file is. Your copy/paste looks to have lost the indentation, which is important for YML
    – Clive
    Oct 6, 2020 at 19:01
  • 2
    are errors not shown on Watchdog? Usually missed files means, that source path is incorrect.
    – Nikit
    Oct 7, 2020 at 1:53

2 Answers 2


You have an an error in your yml file, should be:

# Map the field
field_media_image/title: title
    plugin: media_file_copy
    move: FALSE
    reuse: TRUE
    path: 'public://grants/'
    source: file_path

langcode: langcode
  • hi since its not an image but a bundle of type document, i will use field_media_document where you have field_media_image
    – Diana
    Oct 7, 2020 at 17:17
  • that worked ! except i used language which was the field name in my source table for the language code
    – Diana
    Oct 7, 2020 at 17:42
  • i am having a different problem with step 2 as described here and the yml in the example does not specifiy a bundle.drupal.stackexchange.com/questions/297273/…
    – Diana
    Oct 7, 2020 at 21:00

the answer was that i had to put the nid in the import so the nid was the same in the source and target content in order for this to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.