Describe the problem
When I send a file to my Webhook node with Binary File = ON, the file metadata appears correctly in the Binary tab (file name, mime type, size, download button).
However, in the following Function node, the $binary variable is empty or undefined, so I cannot process the file or convert it to Base64.
What is the error message (if any)?
The Function node returns:
{
"message": "No file found in binary",
"fileMimeType": "unknown"
}
Please share your workflow/code
Webhook node (Binary File ON) → Function node with this code:
javascript
Copiar código
if ($binary && $binary.data) {
const fileData = $binary.data;
return {
fileName: fileData.fileName || "no_name",
fileMimeType: fileData.mimeType || "application/octet-stream",
base64: fileData.data || ""
};
}
// If nothing found in binary
return {
message: "No file found in binary",
fileMimeType: "unknown"
};
⚠️ NOTE: In the Webhook output I can clearly see the file metadata, but in the Function node $binary is empty.
Share the output returned by the last node
json
Copiar código
{
"message": "No file found in binary",
"fileMimeType": "unknown"
}
Debug info
core
n8nVersion: 1.107.4
platform: docker (cloud)
nodeJsVersion: 22.17.0
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
isTouchDevice: false
Generated at: 2025-08-28T05:59:47.693Z
Hi @ADA_BIEN welcome to the
community!
According to the documentation, “You should always use the getBinaryDataBuffer() function”
let binaryDataBufferItem = await this.helpers.getBinaryDataBuffer(itemIndex, binaryPropertyName);
for example, in the code node:
Problem Description
I have an n8n workflow that processes files uploaded via webhook, but it gets stuck at the Switch node and cannot advance to the following nodes. The workflow is designed to process different file types (PDF, images) and route them to different branches based on their type.
Current Workflow Configuration
1. Webhook Upload Document
Data received by the webhook:
2. Switch File Type
-
Mode: Rules
-
Data Type: String
Current configuration that DOESN’T work:
Status:
Shows “No output data in this branch”
3. Following Nodes
What I’ve Tried
-
Different expressions for Value 1:
-
{{ $binary.data.mimeType }}
-
{{ $json.data.mimeType }}
-
{{ $json.data.filename.split('.').pop() }}
-
Different operations:
-
Data verification:
-
The webhook DOES receive files correctly
-
I can download the file from the webhook
-
HTTP request from Postman works (200 OK)
Specific Questions
-
How do I correctly access the MIME type of the individual file when it arrives as multipart/form-data?
-
What’s the correct expression to evaluate file type in the Switch node when the filename has no extension?
-
Is there a way to debug what exact data is available in each node?
Environment Setup
-
n8n version: [indicate version if known]
-
Deployment: [Cloud/Self-hosted]
-
Upload method: Postman with form-data
Screenshots
[I’ve attached screenshots of the working webhook, Switch configuration, and complete workflow]
Has anyone had a similar problem? What’s the correct way to route files by type in n8n?
Any help would be greatly appreciated. I’ve been trying different configurations for several hours without success.
Thanks in advance 