Hi community,
I have the following workflow:
chatinput (with binary) —> a http node (see screenshots and JSON below) , this works and the http node is able to read the binary.
See screenshot:
I then added a function node between the chatinput and the http node, and for some reason the http now seem to have trouble reading the binary file despite that the binary is showing in the input, see screenshot,
It’s complaning with error “This operation expects the node’s input data to contain a binary file ‘data0’, but none was found [item 0]”
I can’t figure out why it failed since the binary definitely passed into the http node.
This is the JSON which is Successful
{
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “https://api.canva.com/rest/v1/asset-uploads”,
“authentication”: “genericCredentialType”,
“genericAuthType”: “oAuth2Api”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Content-Type”,
“value”: “application/octet-stream”
},
{
“name”: “Asset-Upload-Metadata”,
“value”: “={"name_base64": " {{ $json.data[0].name_base64 }} "}”
}
]
},
“sendBody”: true,
“contentType”: “binaryData”,
“inputDataFieldName”: “=data0”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-1260,
-420
],
“id”: “ef098c4c-4e40-476a-bdb4-25041afffefa”,
“name”: “Create asset upload job1”,
“retryOnFail”: false,
“credentials”: {
“oAuth2Api”: {
“id”: “YVCjQRRULdiCtLFd”,
“name”: “Canva 1”
}
},
“onError”: “continueErrorOutput”
},
{
“parameters”: {
“options”: {
“allowFileUploads”: true
}
},
“type”: “@n8n/n8n-nodes-langchain.chatTrigger”,
“typeVersion”: 1.1,
“position”: [
-1600,
-420
],
“id”: “9a7b794b-ae60-43a3-99a5-d019237b4ede”,
“name”: “When chat message received”,
“webhookId”: “04d62079-9f1b-40b7-b5bc-85d7de4f59cc”
}
],
“connections”: {
“Create asset upload job1”: {
“main”: [
]
},
“When chat message received”: {
“main”: [
[
{
“node”: “Create asset upload job1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a”
}
}
This is the JSON which Failed
{
“nodes”: [
{
“parameters”: {
“method”: “POST”,
“url”: “https://api.canva.com/rest/v1/asset-uploads”,
“authentication”: “genericCredentialType”,
“genericAuthType”: “oAuth2Api”,
“sendHeaders”: true,
“headerParameters”: {
“parameters”: [
{
“name”: “Content-Type”,
“value”: “application/octet-stream”
},
{
“name”: “Asset-Upload-Metadata”,
“value”: “={"name_base64": "VGhlIGNyZWF0aW9uIG9mIHRoZSB3b3JsZA=="}”
}
]
},
“sendBody”: true,
“contentType”: “binaryData”,
“inputDataFieldName”: “=data0”,
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-1060,
-440
],
“id”: “ef098c4c-4e40-476a-bdb4-25041afffefa”,
“name”: “Create asset upload job1”,
“retryOnFail”: false,
“credentials”: {
“oAuth2Api”: {
“id”: “YVCjQRRULdiCtLFd”,
“name”: “Canva 1”
}
},
“onError”: “continueErrorOutput”
},
{
“parameters”: {
“mode”: “runOnceForEachItem”,
“jsCode”: “// Input JSON might look like: { "fileName": "My Awesome Upload " }\n\n//const name = $input.item.json[‘[\‘Title/Theme of Bible Story\’]’] || ‘Untitled’;\nconst name = $json.chatInput;\n\nreturn {\n json: {\n name_base64: Buffer.from(name).toString(‘base64’),\n decoded_name: name,\n }\n};”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-1300,
-440
],
“id”: “3121d4c9-2781-48fd-8d2c-5b3980d42d03”,
“name”: “Convert text to base”
},
{
“parameters”: {
“options”: {
“allowFileUploads”: true
}
},
“type”: “@n8n/n8n-nodes-langchain.chatTrigger”,
“typeVersion”: 1.1,
“position”: [
-1540,
-440
],
“id”: “9a7b794b-ae60-43a3-99a5-d019237b4ede”,
“name”: “When chat message received”,
“webhookId”: “04d62079-9f1b-40b7-b5bc-85d7de4f59cc”
}
],
“connections”: {
“Create asset upload job1”: {
“main”: [
]
},
“Convert text to base”: {
“main”: [
[
{
“node”: “Create asset upload job1”,
“type”: “main”,
“index”: 0
}
]
]
},
“When chat message received”: {
“main”: [
[
{
“node”: “Convert text to base”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a”
}
}
Information on your n8n setup
- n8n version: 1.98.2
- Database (default: SQLite): Postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main): default
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Ubuntu
Thanks for taking time assisting.