How I fixed a "content is not valid Base64" Error in n8n v2 GitHub Node
After upgrading from n8n v1 to v2, my workflow that uploads binary files to GitHub suddenly broke with this error:
Your request is invalid or could not be processed by the service
content is not valid Base64
The Root Cause
n8n v2 has a breaking change switching the default binary data storage mode from memory to filesystem(N8N_DEFAULT_BINARY_DATA_MODE=filesystem). This improves performance for large files, but the GitHub node doesn't properly handle the conversion from filesystem-stored binary data to Base64.
In v1, binary data was stored in memory and the GitHub node could directly access and encode it. In v2, binary data is stored as file references, and the node fails to read and encode it correctly.
The Fix
Add an Extract from File node between the binary source and the GitHub node to manually convert the binary data to Base64.
Before (n8n v1 - worked)
HTTP Request → GitHub Node (Binary File: ON)
After (n8n v2 - working solution)
HTTP Request → Extract from File → GitHub Node (Binary File: OFF)
Step-by-Step Solution
1. Add an Extract from File node
Insert it after whatever node produces the binary data (HTTP Request, Read Binary File, etc.) and before the GitHub node.
Configure it with:
- Operation:
Move File to Base64 String - Input Binary Field:
data(or whatever the binary field is named)
2. Update the GitHub node
- Turn OFF the "Binary File" toggle
- Set File Content to:
={{ $json.data }}
Working n8n v2 Workflow
{
"nodes": [
{
"parameters": {
"method": "POST",
"url": "YOUR_SCREENSHOT_SERVICE_URL",
"options": {}
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [400, 300]
},
{
"parameters": {
"operation": "binaryToPropery",
"options": {}
},
"name": "Extract from File",
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1.1,
"position": [600, 300]
},
{
"parameters": {
"resource": "file",
"operation": "edit",
"owner": "YOUR_USERNAME",
"repository": "YOUR_REPO",
"filePath": "path/to/file.png",
"fileContent": "={{ $json.data }}",
"commitMessage": "Update file"
},
"name": "GitHub",
"type": "n8n-nodes-base.github",
"typeVersion": 1,
"position": [800, 300]
}
],
"connections": {
"HTTP Request": {
"main": [[{"node": "Extract from File", "type": "main", "index": 0}]]
},
"Extract from File": {
"main": [[{"node": "GitHub", "type": "main", "index": 0}]]
}
}
}
Key Takeaway
The critical change is that in v2, you can no longer rely on the GitHub node to automatically handle binary-to-Base64 conversion when using filesystem storage mode. The Extract from File node bridges this gap by explicitly converting the binary data to a Base64 string before passing it to GitHub.
Tested on n8n v2.1.4 (Self Hosted) with binaryDataMode: filesystem