I'm using Drupal 8's Migrate API to pull in an RSS Feed as Nodes. The simple_xml data parser seems to require a Unique ID for the import or else I get an error on import.

The XML data is coming from the internet and only has one field applicable as a unique id, however it is preceded by a URL. I process the field with the substr plugin in order to pull in the ID, but when I run the import I get the following error message :

Migration failed with source plugin exception: field_guid has no value

The YAML file includes the following:

    plugin: migrate_gitem_xml
    data_fetcher_plugin: file
    data_parser_plugin: simple_xml
      - www.somesite.com/source/xml-source.xml
  item_selector: '/rss/channel/item'
      type: integer
      name: title
      label: 'Title of the Item'
      selector: title
      name: link
      label: 'Link to the Item'
      selector: link
      name: body
      label: 'Body'
      selector: >
      name: guid
      label: 'ID of the Item'
      selector: guid
      plugin: default_value
      default_value: content_type
      plugin: default_value
      default_value: 1
    title: title
    field_link: link
    body/value: body
    plugin: default_value
    default_value: basic_html
    changed: '@created'
      plugin: substr
      source: guid
      start: 61
      length: 6

Any insight on how to get the Migration to work?


field_guid doesn't exist until the process pipeline runs, which is too late to use as a source ID. You can either simply use guid itself as your ID (with type: string), or do the truncation in prepareRow().

  • Thanks Mike, I'll give it a try and let you know the Results. – GT Tech Life Nov 23 '16 at 21:17
  • Did it work? How? – drupalfan May 3 '17 at 17:14
  • The "ids:" had "field_guid:" instead of just "guid:". – Ryan Price Dec 22 '17 at 22:57

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.