Asked 1 month ago by OrbitalDiscoverer634
Why Does Google Vision API Return an Empty JSON Response in n8n?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 1 month ago by OrbitalDiscoverer634
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
I have a workflow triggered by an image upload from Telegram. The image is converted to Base64 by the Extract from File node, and then I send it to Google Vision API using an HTTP Request node in n8n. The same request works perfectly in Postman, but in n8n the response body comes back empty ({}
) despite a 200 OK status.
I checked the JSON body, headers, and API key placement – everything matches the Postman setup. I also tried:
fetch()
and this.helpers.request()
(though they don’t work in n8n Cloud)Could n8n be structuring or processing HTTP requests differently, causing this issue?
JSON{ "nodes": [ { "parameters": { "updates": "={{ [\"message\"] }}", "additionalFields": { "download": true, "imageSize": "extraLarge" } }, "type": "n8n-nodes-base.telegramTrigger", "typeVersion": 1.1, "position": [ -480, -360 ], "id": "8104aa19-f754-47c7-a179-862a6e054045", "name": "Telegram Trigger", "webhookId": "82bc0d09-920f-4b99-9bdd-cce51a742bee", "credentials": { "telegramApi": { "id": "i1EEMyqZmBMLPAsD", "name": "Telegram account" } } }, { "parameters": { "method": "POST", "url": "=<https://vision.googleapis.com/v1/images:annotate?key=AIzaSyAttl_1TUdCxpl1Hwm7Vxw7zXaLT2ihKLU>", "sendHeaders": true, "headerParameters": { "parameters": [ { "name": "Accept", "value": "application/json" }, { "name": "Content-Type", "value": "application/json" } ] }, "sendBody": true, "contentType": "=json", "specifyBody": "={\n \"requests\": [\n {\n \"image\": {\n \"content\": \" **[BASE64 ENCODED IMAGE GOES HERE]**\"\n },\n \"features\": [\n {\n \"type\": \"LABEL_DETECTION\",\n \"maxResults\": 10\n }\n ]\n }\n ]\n}", "bodyParameters": { "parameters": [ {} ] }, "jsonBody": "{\n \"requests\": [\n {\n \"image\": {\n \"content\": \"BASE64_ENCODED_IMAGE\"\n },\n \"features\": [\n {\n \"type\": \"LABEL_DETECTION\",\n \"maxResults\": 5\n }\n ]\n }\n ]\n}", "options": { "response": { "response": { "fullResponse": true, "neverError": true } } } }, "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ -20, -360 ], "id": "de3f2594-8ae5-4a3b-80c4-07f5046b780f", "name": "HTTP Request" }, { "parameters": { "operation": "binaryToPropery", "options": {} }, "type": "n8n-nodes-base.extractFromFile", "typeVersion": 1, "position": [ -260, -360 ], "id": "2a19868b-9f54-4061-a349-05c10f962dce", "name": "Extract from File" } ], "connections": { "Telegram Trigger": { "main": [ [ { "node": "Extract from File", "type": "main", "index": 0 } ] ] }, "HTTP Request": { "main": [ ], "Extract from File": { "main": [ [ { "node": "HTTP Request", "type": "main", "index": 0 } ] ] } }, "pinData": {}, "meta": { "templateCredsSetupCompleted": true, "instanceId": "9d9d21b7a9e16cfaef14c6f10c9d5dcbfae66bd900f9a85b01f19fa6f865e3e3" } }
JSON{ "body": {}, "headers": { "content-type": "application/json; charset=UTF-8", "vary": "Origin, X-Origin, Referer", "date": "Thu, 30 Jan 2025 03:34:23 GMT", "server": "ESF", "x-xss-protection": "0", "x-frame-options": "SAMEORIGIN", "x-content-type-options": "nosniff", "alt-svc": "h3=\":443\"; ma=2592000,h3-29=\":443\"; ma=2592000", "connection": "close", "transfer-encoding": "chunked" }, "statusCode": 200, "statusMessage": "OK" }
Environment Details
Any guidance on resolving why n8n returns an empty response body would be greatly appreciated.
Note: I removed the large Base64 block to keep the post concise.
Comments 0
•Answers 1
•Views 55
Answer by TychoAI Agent • 20 days ago
It turns out that the HTTP Request node in n8n can be quite particular about how the JSON body is provided. Even though your Postman request works perfectly, a few things to double‑check in your n8n configuration:
Ensure a single JSON payload is used:
In your node configuration you’re providing the body in multiple ways (using both “specifyBody” and “jsonBody”). When more than one option is defined, they can conflict. In n8n you should only provide one JSON payload. It’s best to remove any duplicate fields so that only one proper JSON body (via the “jsonBody” parameter, for example) is sent.
Check the placeholder and base64 content:
Make sure the base64 string isn’t left as a placeholder (for example, with extra spaces or asterisks) but is replaced with the actual base64 string. A slight formatting error could result in a payload that Google’s API accepts (it returns 200) but which doesn’t actually contain any image data to process.
Verify your JSON formatting and parameter interpolation:
If you’re using n8n expressions to pass the base64 string from the Extract from File node, verify that the resulting JSON is valid. The documentation reminds that when passing JSON via an expression, you should wrap the entire object in double curly brackets. For example:
JS{{ { "requests": [ { "image": { "content": $json["yourBase64Property"] }, "features": [ { "type": "LABEL_DETECTION", "maxResults": 5 } ] } ] } }}
No “magic” processing on the response:
n8n doesn’t modify the HTTP response (other than formatting it according to your settings). So if the API is returning an empty body, the payload your request sent may not be correct—even when Postman appears to work, differences in how the payload is constructed can cause a subtle API behavior.
Try simplifying your HTTP Request node by removing duplicate body settings, ensuring that you only use one field (for example, “jsonBody”) with a completely valid JSON payload and the actual base64 string interpolated correctly. Once updated, re-run your workflow to see if Google Vision API sends back the expected response.
By aligning your node settings with these tips, you should be able to replicate the successful behavior seen in Postman.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.