Misleading Error Message re Http Request Form Data Field Values

I just encountered something in the n8n Http Request node where there was an error in the form fields values, but there also happened to be an n8n Binary File form field. The error message seemed to be related to the binary field so I was troubleshooting the wrong thing.

The real problem was that I had another field value, set by an expression that resulted in a non-“form data compatible” type (e.g. boolean). That caused the request to fail with a confusing and misleading message:: data should be a string, Buffer or Uint8Array.

As far as I know, the message was caused by the other field, not the one with the n8n Binary File form data parameter type, but there is no context to make that clear.

So, until the error message includes the problematic form field name(s), maybe this post will provide a clue for someone dealing with a similar scenario.

The error message detail is:

NodeApiError: data should be a string, Buffer or Uint8Array at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:525:33) at processTicksAndRejections (node:internal/process/task_queues:95:5) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:634:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:874:51 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1305:20

Calling workflow

Receiving Workflow

Activate this one, and put its production URL in the Http Request nodes in the other workflow.

Information on your n8n setup

  • n8n version: 1.73.1
  • Database (default: SQLite): postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): docker
  • Operating system: raspberry pi os

Also, unrelated, but demonstrated here, the Accepted File Types on the On form submission trigger seems to be ignored.

The receiving workflow has this:
image

…and the binary data it receives (and does not reject) is (.svg, not .png):

image

Adding a reply to mark as the solution so that this isn’t hanging around tagged as unanswered.

The answer is: If you get an error message that says "data should be a string, Buffer or Uint8Array", don’t assume it is necessarily referring to a binary input that is named data. Look at all parameters that are expecting a string type, and see if any of them have an expression that resolves to a value with a type other than string (boolean, array, object, etc.) In this error message, “data” probably refers to that input value, not the binary part of the item that is named data.

2 Likes

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