I am trying to migrate D7 users into D10.
I have enabled the following migrate modules:
- migrate
- migrate drupal
- migrate plus
- migrate tools
The migration yml is as follows:
id: create_user_account
migration_group: site_import
label: 'Create User accounts'
source:
  plugin: d7_user
process:
  uid:
    - plugin: skip_on_value
      equals: true
      source: uid
      method: row
      value:
        - 1
  name: name
  pass: pass
  mail: mail
  created: created
  access: access
  login: login
  status: status
  timezone: timezone
  langcode:
    - plugin: default_value
      default_value: 'en'
  preferred_langcode:
    - plugin: default_value
      default_value: 'en'
  preferred_admin_langcode:
    - plugin: default_value
      default_value: 'en'
  init: init
  field_user_picture:
    - plugin: sub_process
      source: field_photo
      process:
        target_id: fid
        alt: alt
        title: title
        width: width
        height: height
  field_area:
    - plugin: extract
      source: field_area
      default: null
      index:
        - 0
        - value
  field_name/value:
    - plugin: extract
      source: field_name
      default: null
      index:
        - 0
        - value
  field_phone_number_1/value:
    - plugin: extract
      source: field_phone_number_1
      default: null
      index:
        - 0
        - value
  field_phone_number_2/value:
    - plugin: extract
      source: field_phone_number_2
      default: null
      index:
        - 0
        - value
  field_position:
    - plugin: extract
      source: field_position
      default: null
      index:
        - 0
        - value
  roles:
    - plugin: callback
      callable: var_dump
      source: roles
    - plugin: sub_process
      process:
        target_id:
          plugin: static_map
          bypass: true
          source: roles
          map:
            "1": anonymous
            "2": authenticated
            "3": administrator
            "4": housing_member
            "7": content_editor
destination:
  plugin: 'entity:user'
Everything migrates as expected EXCEPT the roles.
roles var_dump outputs something like:
string(1) "3"    
string(1) "7"
for each user, but the users fail to import with the following error:
create_user_account:roles:sub_process: Input array should hold elements of type array, instead element was of type 'NULL'
which I though would be managed by 'bypass: true'.
My initial map used [without quotes]
1: anonymous
etc
But had the same error.
If I disable the roles element, the users will import as expected. How do I create the required static_map structure for the migration to work as expected?