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
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
Method: POST
Path: /upload-documento
Response: 200
Binary File: Enabled
Status: WORKING CORRECTLY
Data received by the webhook:
File Name: b2ec3d86-f31d-4f4c-8c33-bb6d4d95c925 (no extension)
Mime Type: multipart/form-data
File Size: 1.04 MB
2. Switch File Type
Mode: Rules
Data Type: String
Current configuration that DOESN’T work:
Value 1: {{ $json.data.filename.split('.').pop() }}
Routing Rules:
Rule 1: Equal → application/pdf → Output Key: 1
Rule 2: Contains → jpeg → Output Key: 2
Status: Shows “No output data in this branch”
3. Following Nodes
JS Processing and Base64 (receives no data)
Other nodes for OCR and processing (not executed)
What I’ve Tried
Different expressions for Value 1:
{{ $binary.data.mimeType }}
{{ $json.data.mimeType }}
{{ $json.data.filename.split('.').pop() }}
Different operations:
Equal vs Contains
Various comparison values (pdf, application/pdf, jpeg, image/jpeg)
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.