Error with binary file only occurs when executing full workflow (not when previous is pinned)

Describe the problem/error/question

After downloading a base64 encoded PDF from an accounting software, I use a Code module to convert it to binary. I then attempt to upload the result as n8n binary data to ElasticEmail using a HTTP module. Whenever I execute the workflow manually or activate the workflow, I encounter an error in the module that uploads the file to ElasticEmail. Strangely enough, if I pin the previous modules and rerun the upload file module not from the beginning but with the current data, the process seems to work just fine. After some days of testing, I am publishing this post to see if someone is encountering a similar error. Hope we can help others too and thanks in advance for your help.

What is the error message (if any)?

ERROR: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined

TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at Function.from (node:buffer:328:9)
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:1104:45)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:652:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:68

Please share your workflow

Share the output returned by the last node

Here is a 45-sec video of the problem as seen in the real workflow (workflow above is a simulation of what’s happening): Loom Video

Information on your n8n setup

  • n8n version: Version 0.231.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 22.04.2 LTS

Hi @relayj, welcome to the community :tada:

I am sorry you are having trouble here. I could reproduce the problem using your example workflow and am wondering if the problem might be due to how you are processing binary data in your n8n instance.

Perhaps you can give using the Move Binary Data node instead of the Code node a go? Like so:

Please do let me know if you still run into any trouble with this approach :slight_smile:

3 Likes

Thank you so much @MutedJam!

I tried with Move Binary Data following your example workflow and after some fixes it works perfectly!

I would be happy to share more info on what I was doing wrong, but I don’t know exactly. Probably using the Code node was not the optimal way.

Thank you again!

1 Like

Awesome, glad to hear this works for you :slight_smile:

1 Like

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