Write Binary File Error: No Binary Data exists on Item

Describe the problem/error/question

I have a simple workflow (I think) of 4 nodes. Read Binary Files, Read PDF, Code and Write Binary File.

The Read Binary Files node outputs a PDF from my filesystem to the ReadPDF Node. The Code Node receives the contents of the PDF and extracts a date which I want to use as the Filename. The date is passed to the Write Binary File node.

Everything works fine except the Write Binary File node. I have configured the Property Name expression as {{ $node[“Read Binary Files”].binary.data }} or {{ $node[“Read Binary Files”].binary }} and i get the same error.

What is the error message (if any)?

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n 0.227.1

Solved it - in case someone else has similar issues - the code node was only returning the date, i needed to also return the ‘binary’ item.

added the following ‘return’ statement at the end of the code node:

return [{
    binary: {
      data: items[0].binary.data,
      fileName: items[0].binary.fileName,
      mimeType: items[0].binary.mimeType
    },
    json: {
      date: formattedDate
    }
  }];
} else {
  return [];
}
3 Likes

Thanks so much for sharing your solution with others, @Pebble !

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.