How to attach media item created during migration to media field in node I am migrating content from Drupal 7 to Drupal 8.
There is an audio field that I am currently moving to media via a custom process during migration.

When I get the id of the new media created I can't seem to get it to attach to my new media reference field in the also newly created node.

Can anyone tell me what is wrong with the import below?

field_audio_fileinfo:
-
  plugin: sub_process
  source: field_audio_fileinfo
  process:
    target_id:
      -
        plugin: migration_lookup
        method: process
        source: fid
        migration: upgrade_d7_file
      -
        plugin: my_custom_process
        destination: field_media_audio


In my custom process I can save the media and get it's ID via:

$media_id = $audio_media-&gt;id();
$arr[] = array(
  'target_id' =&gt; $media_id,
  'display' =&gt; NULL,
  'description' =&gt; NULL
);
return $arr;


But it doesn't seem to populate the destination field.

This is also the case if I just return the ID directly from the process.
When I have done a similar type of migration at that time I did the following steps:


First I created media type Audio in Drupal 8 and it's fields.
Then I exported all audio file details and FID from D7 and created csv file.
Written migration script to import audio into media.


Example: 

source:
  plugin: csv
  path: 'csv file path'
  header_row_count: 1
  keys:
    - fid
  type: audio
  constants:
    bundle: audio
process:
  mid: fid
  bundle: constants/bundle
  langcode:
    plugin: default_value
    source: language
    default_value: und
  name: filename
  uid: uid
  created: upload_date
  changed: upload_date
  field_media_audio_file/target_id: fid
destination:
  plugin: 'entity:media'
  migration_dependencies: {  }
migration_dependencies: null



The same csv I used to import data into file entity and written migration script.


Example:

source:
  plugin: csv
  path: 'csv file path'
  header_row_count: 1
  keys:
    - fid
process:
  uid: uid
  fid: fid
  filename: filename
  created: upload_date
  changed: upload_date
  filemime: mime
  uri: uri
destination:
  plugin: 'entity:file'
  source_path_property: filepath
  destination_path_property: uri
migration_dependencies: {  }



After that, I attached the FID to my node field.



process:
  field_audio/target_id: fid

  
  I am keeping media id, FID of Drupal 8 same as FID of Drupal 7. So we
  can attach the same FID to the node directly.