HTTP Request Node not returning the correct binary file

Describe the problem/error/question

Using HTTPS Request node, I post a PDF to Stirling PDF and it responds with a ZIP file containing the JPG version of the PDF.

However, the HTTPS node does not output this binary file. In the screenshot, see the binary output “items”=1, but it shows both the input pdf file and the returned zip file, so that should be 2 items?. Oddly I can download these from this screen, the PDF file is the actual input file to the HTTP request, and the ZIP file is the actual file returned from the HTTPS request. However, the ZIP file does not appear in the HTTPS node output Schema, and although it appears listed in the binary files tab on the output, I can’t actually access it from subsequent nodes. Am I missing something obvious? I’d appreciate any pointers.

HTTPS Node, note the output shows binary items = 1, although there are 2 files present.

HTTPS Node, sam as above, but see Schema only shows the PDF file.

Here is a default Code see the input shows binary items =1 although 2 files are present.

Same as above showing schema is missing the ZIP file,.

What is the error message (if any)?

None

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“formTitle”: “Load File”,
“formFields”: {
“values”: [
{
“fieldLabel”: “pdfInputFile”,
“fieldType”: “file”,
“acceptFileTypes”: “*.zip”,
“requiredField”: true
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.formTrigger”,
“typeVersion”: 2.2,
“position”: [
-920,
560
],
“id”: “dc85bdb2-9566-4284-a67c-c1056e8f251a”,
“name”: “Submit Multipage PDF”,
“webhookId”: “260fa9ba-0878-4eb2-9bc6-b2e36974b2db”
},
{
“parameters”: {
“method”: “POST”,
“url”: “https://stirlingpdf.io/api/v1/convert/pdf/img”,
“sendBody”: true,
“contentType”: “multipart-form-data”,
“bodyParameters”: {
“parameters”: [
{
“parameterType”: “formBinaryData”,
“name”: “fileInput”,
“inputDataFieldName”: “pdfInputFile”
},
{
“name”: “imageFormat”,
“value”: “jpg”
},
{
“name”: “singleOrMultiple”,
“value”: “multiple”
},
{
“name”: “dpi”,
“value”: “300”
}
]
},
“options”: {}
},
“type”: “n8n-nodes-base.httpRequest”,
“typeVersion”: 4.2,
“position”: [
-640,
560
],
“id”: “df861623-db6c-4348-825d-946bd3902c09”,
“name”: “HTTP Request”,
“alwaysOutputData”: true
},
{
“parameters”: {
“jsCode”: “// Loop over input items and add a new field called ‘myNewField’ to the JSON of each one\nfor (const item of $input.all()) {\n item.json.myNewField = 1;\n}\n\nreturn $input.all();”
},
“type”: “n8n-nodes-base.code”,
“typeVersion”: 2,
“position”: [
-340,
560
],
“id”: “81b5ba03-e803-44df-8b04-be1470e39d13”,
“name”: “Code1”
}
],
“connections”: {
“Submit Multipage PDF”: {
“main”: [
[
{
“node”: “HTTP Request”,
“type”: “main”,
“index”: 0
}
]
]
},
“HTTP Request”: {
“main”: [
[
{
“node”: “Code1”,
“type”: “main”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“templateCredsSetupCompleted”: true,
“instanceId”: “051c749b6a6060f3aa911b6c669df739f74b1f876a4b14a167ec1cfbe11ebba6”
}
}

Information on your n8n setup

n8n version:1.84.3
Database (default: SQLite): N/A Default
n8n EXECUTIONS_PROCESS setting (default: own, main): Default
Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
Operating system: Windows 11, tested with Chrome and Edge

Files are slightly confusing on n8n.

They do not show up as outputs similar to other keys. It is a visual reference. The one item output with showing the input file is correct:

Nodes that can take file inputs will take the file “key” as input as a string. If you want to safely access them within a code node or via an expression you would use something like:

Thx, it was confusing and I managed to get to the zip file using the “$input.first().binary.data” object. See screenshot below, the code is a little redundant, but it shows the object journey from the output of the HTTPS node, into the Code node, having its extension set to “zip”, and then output to the next node. Some of the files I will pass through this need that extension setting to zip.

I’m slightly confused. Why are you trying to change the extension when its already a .zip? If only some are to be zip files, you can use a switch node to change to a different route with zip changes.

But if they are all zip files but only some have the extension, the decompress node should still work with or without the extension, as its mostly just an indicator of filetype.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.