n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
45.7k stars 6.36k forks source link

Response Webhook do not accept `false` as response body property value #5587

Closed marlom-rvvup closed 1 year ago

marlom-rvvup commented 1 year ago

Describe the bug

When using the node Respond to Webhook containing property within an object as boolean false n8n translates it to nothing, ending up with an invalid JSON, leading to workflow error.

To Reproduce

Use this workflow ```json { "name": "Test response boolean", "nodes": [ { "parameters": { "path": "test", "responseMode": "responseNode", "options": {} }, "id": "d9fbf5ea-0127-41ca-8c10-6610ef18f373", "name": "Webhook", "type": "n8n-nodes-base.webhook", "typeVersion": 1, "position": [ 1100, 560 ], "webhookId": "1feba836-372f-49b3-8205-353fd1b1ce11" }, { "parameters": { "keepOnlySet": true, "values": { "boolean": [ { "name": "shouldWork" } ] }, "options": {} }, "id": "ed645a9b-7ae0-413c-b69f-e55d12853f38", "name": "Set", "type": "n8n-nodes-base.set", "typeVersion": 1, "position": [ 1320, 560 ] }, { "parameters": { "respondWith": "json", "responseBody": "={\n \"iShouldBeValid\": {\n \"amIValid\": {{ $json.shouldWork }}\n }\n}", "options": {} }, "id": "8b0dd28d-892f-47bc-a3b5-c12dadc69675", "name": "Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "typeVersion": 1, "position": [ 1540, 560 ] } ], "pinData": {}, "connections": { "Webhook": { "main": [ [ { "node": "Set", "type": "main", "index": 0 } ] ] }, "Set": { "main": [ [ { "node": "Respond to Webhook", "type": "main", "index": 0 } ] ] } }, "active": false, "settings": {}, "versionId": "b04109a0-678e-41fc-bc8a-7a7f52f46a38", "id": "467857690", "meta": { "instanceId": "4a76d51d29a71c5b99488f8a7cce39b7774a5946d79d1bf7ecaf14e675bdeaed" }, "tags": [] } ```

Expected behavior Once a property passed is a boolean false, it should use that as expected instead of converting it to an empty string by the parser (I assume it does that 😅 )

Environment (please complete the following information):

Joffcom commented 1 year ago

Hey @marlom-rvvup,

Thanks for the report this is something that we are are tracking internally as ADO-217, We already have a Github issue open for the root cause of this here: https://github.com/n8n-io/n8n/issues/3270 so for now I am going to close this one and any updates will be on the other issue.