Incoming Base64 FileStream to Outgoing Binary HTTP Request

Hello,

I’m trying to convert a Base64 encoded filestream encapsulated in a JSON and sent it with an HTTP request as Binary stream to an endpoint. The endpoint needs to receive a binary Filestream and a Content-Type header: application/pdf, together with two headers for authentication. Do I need to set the body content type to RAW/custom? If I do so I get a message “cannot set header accept in the string”. With Multipart/Formdata It processes, but then it breaks on the receiving side, because they want binary, not Multipart/formdata. Any ideas?

{
“name”: “UploadBinaryPDF”,
“nodes”: [
{
“parameters”: {},
“name”: “Start”,
“type”: “n8n-nodes-base.start”,
“typeVersion”: 1,
“position”: [
250,
300
]
},
{
“parameters”: {
“httpMethod”: “POST”,
“path”: “413fc66e-641c-4952-ba17-5374c5077721”,
“options”: {}
},
“name”: “Webhook”,
“type”: “n8n-nodes-base.webhook”,
“typeVersion”: 1,
“position”: [
280,
460
],
“webhookId”: “413fc66e-641c-4952-ba17-5374c5077721”
},
{
“parameters”: {
“requestMethod”: “PUT”,
“url”: “={{$node["Webhook"].json["body"]["uploadURL"]}}”,
“jsonParameters”: true,
“options”: {
“bodyContentType”: “multipart-form-data”
},
“sendBinaryData”: true,
“headerParametersJson”: “={\n"authorization":"{{$node["Webhook"].json["headers"]["authorization"]}}",\n"application":"{{$node["Webhook"].json["headers"]["application"]}}"\n}”
},
“name”: “HTTP Request”,
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 1,
“position”: [
650,
460
]
},
{
“parameters”: {
“mode”: “jsonToBinary”,
“convertAllData”: false,
“sourceKey”: “body.file”,
“options”: {
“dataIsBase64”: true,
“fileName”: “={{$node["Webhook"].json["body"]["fileName"]}}”,
“mimeType”: “={{$node["Webhook"].json["body"]["mimeType"]}}”
}
},
“name”: “Move Binary Data”,
“type”: “n8n-nodes-base.moveBinaryData”,
“typeVersion”: 1,
“position”: [
460,
460
]
}
],
“connections”: {
“Webhook”: {
“main”: [
[
{
“node”: “Move Binary Data”,
“type”: “main”,
“index”: 0
}
]
]
},
“Move Binary Data”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“active”: true,
“settings”: {},
“id”: 18
}

Try it like the image below. Make sure the headers are a JSON with key-value pairs.

Example Workflow:

Cannot create property ‘Content-Type’ on string

…different error now…