Skip to content

HTTP Request Node with multipart/form-data ContentType Empty Array #21109

Description

@jamesabrannan

See chatgpt summary of bug at end.

Describe the problem/error/question

The HTTPPost Node Method POST, Send Body ON, Body Content Type Form-Data. Try to post two valid n8n Binary File Paramater Type with valid Name and valid input data and the form post is not sending the file's data, only a null.

This works in postman and works when I write external node.js script, only fails to work in n8n

What is the error message (if any)?

Server returns.

"400 - "{\"id\":\"aee4184b-9ba0-4d73-93ab-7d4840e4646a\",\"message\":\"Array cannot be null. (Parameter 'bytes')\"}"",

Please share your workflow/screenshots/recording

{
"name": "DynamicPDF dlex-layout Endpoint Local",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
0,
0
],
"id": "60bf18b5-8e74-4ab8-9772-b03b084f23f1",
"name": "When clicking ‘Execute workflow’"
},
{
"parameters": {
"fileSelector": "/temp/n8n-examples/resources/dlex-layout/creating-pdf-dlex-layout.txt",
"options": {}
},
"type": "n8n-nodes-base.readWriteFile",
"typeVersion": 1,
"position": [
208,
0
],
"id": "299b106d-f949-49d3-a360-54b968c5cb4f",
"name": "Read/Write Files from Disk"
},
{
"parameters": {
"fileSelector": "/temp/n8n-examples/resources/dlex-layout/creating-pdf-dlex-layout.dlex",
"options": {}
},
"type": "n8n-nodes-base.readWriteFile",
"typeVersion": 1,
"position": [
656,
0
],
"id": "62b37bbb-dd8d-400d-ba80-54c894291956",
"name": "Read/Write Files from Disk2"
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "item.binary.data_json = item.binary.data;\ndelete item.binary.data;\nitem.json.mergeKey = 1;\nreturn item;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
416,
0
],
"id": "d312ffe4-a95e-4ca3-b3f8-d1f888647714",
"name": "Code in JavaScript"
},
{
"parameters": {
"method": "POST",
"url": "https://api.dpdf.io/v1.0/dlex-layout",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"contentType": "multipart-form-data",
"bodyParameters": {
"parameters": [
{
"parameterType": "formBinaryData",
"name": "=LayoutData",
"inputDataFieldName": "data_json"
},
{
"parameterType": "formBinaryData",
"name": "Resource",
"inputDataFieldName": "data_dlex"
}
]
},
"options": {
"response": {
"response": {
"fullResponse": true,
"neverError": true
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1728,
-480
],
"id": "87f7f0ca-f352-4476-947b-cbe688a519bc",
"name": "HTTP Request",
"alwaysOutputData": true,
"credentials": {
"httpHeaderAuth": {
"id": "iFqDKznB9ParA7me",
"name": "Header Auth account"
}
},
"onError": "continueRegularOutput"
},
{
"parameters": {
"operation": "write",
"fileName": "/temp/n8n-examples/output/dlex-local-out.pdf",
"dataPropertyName": "combined_data",
"options": {}
},
"type": "n8n-nodes-base.readWriteFile",
"typeVersion": 1,
"position": [
2208,
-496
],
"id": "25cdf5a6-b2fd-48fd-ab3e-db77ac006ff1",
"name": "Read/Write Files from Disk1"
},
{
"parameters": {
"mode": "runOnceForEachItem",
"jsCode": "item.binary.data_dlex = item.binary.data;\ndelete item.binary.data;\nitem.json.mergeKey = 1;\nreturn item;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
960,
-192
],
"id": "e13da150-9206-44e4-b0ad-2c5a86e67a1b",
"name": "Code in JavaScript1"
},
{
"parameters": {
"jsCode": "return [{\n json: {\n binaryKeys: Object.keys(items[0].binary || {}),\n sizes: Object.fromEntries(Object.entries(items[0].binary || {}).map(([k,v]) => [k,v.data?.length||0]))\n },\n binary: items[0].binary\n}];\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1488,
-416
],
"id": "252159ec-bba9-4e41-bd36-69c44944961c",
"name": "Code in JavaScript2"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineAll",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1152,
-576
],
"id": "0c8d985d-a877-4295-b763-e50c351d648f",
"name": "Merge"
}
],
"pinData": {},
"connections": {
"When clicking ‘Execute workflow’": {
"main": [
[
{
"node": "Read/Write Files from Disk",
"type": "main",
"index": 0
}
]
]
},
"Read/Write Files from Disk": {
"main": [
[
{
"node": "Code in JavaScript",
"type": "main",
"index": 0
}
]
]
},
"Read/Write Files from Disk2": {
"main": [
[
{
"node": "Code in JavaScript1",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript": {
"main": [
[
{
"node": "Read/Write Files from Disk2",
"type": "main",
"index": 0
},
{
"node": "Merge",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Read/Write Files from Disk1",
"type": "main",
"index": 0
}
]
]
},
"Code in JavaScript1": {
"main": [
[
{
"node": "Merge",
"type": "main",
"index": 1
}
]
]
},
"Code in JavaScript2": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"Merge": {
"main": [
[
{
"node": "Code in JavaScript2",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "c5fc7740-c72f-4437-b63e-6d609a209ae7",
"meta": {
"instanceId": "cf3ce71e2d4c42097cb0560c37c3f1540cd97dea40af8f3f4791b1bb42fd7a9c"
},
"id": "x1pXbWgmfUqhO9G3",
"tags": []
}

Share the output returned by the last node

[
{
"error": {
"message": "400 - "{\"id\":\"1f123624-28a5-43fe-941f-60056b81ba81\",\"message\":\"Array cannot be null. (Parameter 'bytes')\"}"",
"name": "AxiosError",
"stack": "AxiosError: Request failed with status code 400\n at settle (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\axios\lib\core\settle.js:19:12)\n at RedirectableRequest.handleResponse (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\axios\lib\adapters\http.js:565:9)\n at RedirectableRequest.emit (node:events:530:35)\n at RedirectableRequest._processResponse (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\follow-redirects\index.js:409:10)\n at ClientRequest.RedirectableRequest._onNativeResponse (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\follow-redirects\index.js:102:12)\n at Object.onceWrapper (node:events:633:26)\n at ClientRequest.emit (node:events:518:28)\n at HTTPParser.parserOnIncomingClient [as onIncoming] (node:_http_client:704:27)\n at HTTPParser.parserOnHeadersComplete (node:_http_common:117:17)\n at TLSSocket.socketOnData (node:_http_client:546:22)\n at Axios.request (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\axios\lib\core\Axios.js:45:41)\n at processTicksAndRejections (node:internal/process/task_queues:105:5)\n at invokeAxios (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\node-execution-context\utils\request-helper-functions.ts:313:10)\n at proxyRequestToAxios (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\node-execution-context\utils\request-helper-functions.ts:695:20)\n at Object.request (C:\Users\James Brannan\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\src\execution-engine\node-execution-context\utils\request-helper-functions.ts:1749:4)",
"code": "ERR_BAD_REQUEST",
"status": 400
}
}
]

ChatGPT summary of bug

🐛 Bug Report: HTTP Request Node Fails on Multipart Form-Data with Multiple Binaries
Summary

When using the HTTP Request node to POST multiple binary fields via multipart/form-data, the node throws:

Array cannot be null

The same request works correctly in Postman or a standalone Node.js script using fetch or form-data.

Environment

n8n version: (latest local release as of Oct 2025)

Install method: n8n CLI (local sandboxed runtime)

Node.js version: v22.11.0

Platform: Windows 10 x64 (also reproduced on macOS)

Mode: Local sandboxed (also reproducible with --no-sandbox)

Steps to Reproduce

Add two Read Binary File nodes:

File A = creating-pdf-dlex-layout.txt

File B = creating-pdf-dlex-layout.dlex

Merge the two items (mode = Append) → single item containing both binaries.

Connect to HTTP Request node:

Method: POST

URL: https://api.dynamicpdf.com/v1.0/dlex-layout

Authentication: Header → Authorization: Bearer

Content Type: multipart/form-data

Body Parameters:

LayoutData → binary → data_json

Resource → binary → data_dlex

Execute workflow.

Result:
Node fails immediately with Array cannot be null.
Server receives no data.

Expected:
Multipart request with both binaries properly streamed (works in Postman and Node.js).

Observed Behavior

Works with one binary field.

Fails when two or more binaries are included.

Occurs both with and without sandbox mode.

Error originates in internal multipart builder before the HTTP request is sent.

Workarounds

Zip both files into a single binary (.zip) and send as one form field.

Use an Execute Command node to run an external Node.js script using form-data.

Use an external relay service to perform the multipart POST.

Impact

Prevents workflows that rely on uploading multiple binary resources (e.g., DynamicPDF Cloud API, file-upload REST endpoints, etc.) from running in local or self-hosted n8n environments.

Notes

Confirmed reproducible on clean installations with Node 18 → 22.
Not reproducible on n8n Cloud (non-sandboxed runtime).

Debug info

core

  • n8nVersion: Version: 1.116.2
  • platform: local sandbox
  • nodeJsVersion: 22.11.0
  • nodeEnv: production
  • database: sqlite
  • executionMode: regular
  • concurrency: 5
  • license: community

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 168 hours
  • maxCount: 2500 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/141.0.0.0 safari/537.36
  • isTouchDevice: false

Generated at: 2025-10-23T15:44:11.655Z}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions