n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
45.77k stars 6.39k forks source link

Functional Item does not seem to receive binary data nor send it along to the next node #840

Closed pcross616 closed 4 years ago

pcross616 commented 4 years ago

Been trying to implement a clean up step after receiving and email with an attachment. I have it fully functional without a Function Item.

This works:

Screen Shot 2020-08-14 at 10 01 37 AM

Once I add a basic step to parse the email domain from the item properties. I don't see binary data being passed in nor is it available on any node past the Functional Item.

Does not work: Screen Shot 2020-08-14 at 10 07 46 AM

This could very well be user error and not done correctly, but I have searched documentation and community forums and everything seems that this should work. I have looked in to setBinaryData and getBinaryData but nothing I did seem to make a different.

Any help or guidance would be great.

To Reproduce Steps to reproduce the behavior:

  1. Add an IMAP Email Read node + configure to pull email and download attachment
  2. Add Functional Item Note: sorry the regex messed with the code snippet option in the issue.

var reg = /[a-z0-9!#$%&'+\/=?^_`{|}~-]+(?:.[a-z0-9!#$%&'+\/=?^_`{|}~-]+)@(?:[a-z0-9](?:[a-z0-9-][a-z0-9])?.)+a-z0-9?/ var email = reg.exec(item.from); var domain = /@(\w+)/.exec(email)[1]; item.vendor = domain; return item;

  1. Add SFTP node + configure to upload to server using binary data Note: I see the updated item properties in the SFTP node with the vendor and no errors are reported in the Functional Item
  2. See error on SFTP node ERROR: No binary data property "attachment_0 " does not exists on item! Error: No binary data property "attachment_0 " does not exists on item! at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Ftp.node.js:284:35) at processTicksAndRejections (internal/process/task_queues.js:97:5) at async /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:369:47

Expected behavior I would expect the binary data be available in the node downstream from Function Item just like if it was not there in the working example

Environment (please complete the following information):

janober commented 4 years ago

Thanks a lot for making us aware of the problem @pcross616!

Sorry about that! Just fixed the bug and will release it with the next version. I will inform you here once it got released.

janober commented 4 years ago

Btw. as a workaround it is best to use the Function-Node instead.

pcross616 commented 4 years ago

Thanks was just looking in to that as a next option. Love the simple fixes, I thought it might have been that but didn't know the code well enough yet to ensure that was it.

janober commented 4 years ago

You are welcome! Yes was very easy to fix. Was a simple oversight when I originally programmed the node.

janober commented 4 years ago

Got released with n8n@0.78.0