If your n8n nodes handling data stream are losing data, truncating files or hanging, enable node binary mode, write big payloads to disk, use SplitInBatches for chunked processing and adjust your reverse proxy body limits. The patterns below stop most stream and large payload failures end to end.
Why n8n nodes handling data stream fail
Streams and very large messages fail in n8n for three common reasons. First, nodes are returning JSON text instead of binary, so downstream nodes attempt to parse a truncated payload. Second, memory and Node process limits mean very large buffers cause the process to stall or be killed. Third, reverse proxies like Nginx or load balancers reject or buffer large request bodies, producing errors such as PayloadTooLargeError or ECONNRESET.
Step by step fix
- Identify binary content. If the incoming webhook or API returns non-JSON (images, videos, base64 or file streams), treat it as binary not text. In practice this means using an HTTP node that can return files, or the webhook node in binary mode.
- Use the HTTP Request node with file response. In the HTTP Request node set the response format to a file or binary option, and set the
Binary Propertyname (for exampledata). - Persist to disk before heavy processing. Pipe the HTTP Request output to a
Write Binary Filenode. Write to a temp path such as/tmp/{{Date.now()}}_downloadso the pipeline does not hold the whole file in memory. - Process in chunks. For lists or repeating messages use the
SplitInBatchesnode. A batch size of 1 to 5 keeps node memory low when each item contains a binary file reference. - Read from disk when needed. Use
Read Binary Fileto stream the file into a node that must upload it or run a command. Avoid passing large binary fields through many nodes as JSON. - Adjust server and proxy limits. Set your reverse proxy
client_max_body_sizeto the expected maximum, and increase Node memory if your workflows must buffer big data.
Tool specific notes for n8n
n8n gives you nodes and properties to handle binary safely. Use these concrete patterns.
- HTTP Request: set Method to
GETorPOST, set Response Format to a file/binary option, and enterdataforBinary Property. This places file content in the workflow item binary bag, not JSON. - Webhook: if receiving raw uploads, ensure the webhook node is not treating payload as JSON. If the payload comes as a file part, the webhook will expose it in binary. Inspect the Incoming Data tab to confirm binary fields appear.
- Write Binary File and Read Binary File: use these to persist large files to disk and re-import them without putting them in the node memory. Set explicit absolute paths under
/tmpon Linux servers. - Execute Command: when a node library cannot stream large data, use
Execute Commandto run a streaming tool such ascurlorffmpeg. Example to download a remote file directly to disk:
Then usecurl -sSL "https://example.com/large.mp4" -o /tmp/large.mp4Read Binary Fileto pick that file up. This prevents n8n from keeping the whole file in memory. - SplitInBatches: use the
SplitInBatchesnode when you must perform repeated uploads or calls with large payloads. Set Batch Size to a low number, and connect the batch output to nodes that read each binary file from disk. This is the standard pattern forn8n stream data between nodessafely.
Server and config tweaks to stop streams breaking
Even with correct node patterns, external limits break streams. Check these settings.
- Nginx proxy: set
client_max_body_size 50M;or higher under the server block. Also setproxy_request_buffering off;to reduce buffering on large uploads. - Load balancers and API gateways: ensure they are not truncating or timing out. Set idle timeout high enough for long uploads.
- Node memory: if you must process in-memory, increase Node memory with an environment variable such as
NODE_OPTIONS=--max-old-space-size=4096for 4GB. Use this only when you understand memory needs. - n8n Docker: map a writable tmp directory into the container, for example
-v /tmp/n8n:/tmp, soWrite Binary Filecan persist without permission errors.
Quick importable workflow template
Copy and import this minimal n8n workflow JSON to test the pattern: it downloads a file as binary and writes it to disk. Set the HTTP Request node URL after import.
{
"name": "Stream download to disk",
"nodes": [
{"parameters": {}, "name": "Start", "type": "n8n-nodes-base.start", "typeVersion": 1, "position": [250, 300]},
{"parameters": {"requestMethod": "GET", "url": "https://example.com/file","responseFormat": "file","binaryPropertyName": "data"}, "name": "HTTP Request", "type": "n8n-nodes-base.httpRequest", "typeVersion": 1, "position": [450, 300]},
{"parameters": {"fileName": "={{$binary[\"data\"].fileName || 'download.bin'}}","filePath": "/tmp/{{Date.now()}}_download"}, "name": "Write Binary File", "type": "n8n-nodes-base.writeBinaryFile", "typeVersion": 1, "position": [650, 300]}
],
"connections": {"Start": {"main": [[{"node": "HTTP Request", "type": "main", "index": 0}]]}, "HTTP Request": {"main": [[{"node": "Write Binary File", "type": "main", "index": 0}]]}}
}
After import, update the HTTP Request URL, run the workflow and confirm a file appears in /tmp. Use this as the base for larger pipelines so binary data moves by reference, not as huge JSON bodies.
How to stop it happening again
- Always treat files and streams as binary. Confirm nodes show binary fields in the output inspector.
- Persist large blobs to disk early using
Write Binary Fileand read them only when needed. - Use
SplitInBatchesto avoid large arrays of binary items flowing through many nodes. - Monitor logs for
PayloadTooLargeErrorand increase proxy limits proactively.
When to get help
If workflows still hang with ECONNRESET, if files are truncated even after using binary files, or you see out of memory crashes, collect node logs and the browser workflow execution trace and ask for help. Community threads such as this troubleshooting thread on binary streams and this openwa trigger failure discussion often help diagnose specific node issues.
How n8n nodes handling data stream and n8n openwa message receive trigger failure show real examples you can compare to your logs.
Want to learn to build automations like this? Join Automate Naija to practice these patterns and deploy production-ready n8n workflows.
Frequently asked questions
Why does my n8n workflow truncate large file uploads?
Truncation commonly comes from proxy limits or from treating a file as text. Check your reverse proxy settings such as Nginx client_max_body_size , and ensure the source node (Webhook or HTTP Request) is configured to return binary, not JSON. Persist to disk early to avoid truncation.
How do I stream a large file between nodes without running out of memory?
Write the incoming file to disk with Write Binary File and read it when you need it with Read Binary File . Use SplitInBatches to process many items one at a time so you never hold many large files in memory simultaneously.
Can I use Execute Command to handle streaming in n8n?
Yes. Use the Execute Command node to run a tool like curl or ffmpeg to stream directly to disk, for example: curl -sSL "https://example.com/large.mp4" -o /tmp/large.mp4 Then import the file with Read Binary File to avoid buffering in n8n.
What errors should I look for in logs when streams fail?
Watch for PayloadTooLargeError , ECONNRESET , out of memory messages, and proxy 413 status codes. Also inspect the n8n execution UI for missing binary fields; if a node shows no binary content, the upstream node is not returning a proper binary property.
Build it with us. The community is free and the build track teaches this kind of automation week by week: see pricing or join the community.