HTTP Request Error: Argument error, options.body

I received error when use HTTP Request method GET and Headers: {{JSON.parse(’{“Cookie”: “JSESSIONID=…”}’)}}

Error: RequestError: Error: Argument error, options.body.
    at Object.execute (C:\Users\rodrigo\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-nodes-base\dist\nodes\HttpRequest.node.js:762:27)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async C:\Users\rodrigo\AppData\Roaming\npm\node_modules\n8n\node_modules\n8n-core\dist\src\WorkflowExecute.js:369:47

Received file PDF success in Postman:

That seems to be a bug. It sets the body even though it should not (as it is a GET request). Will fix it.

Got fixed. Will update here once it got released.
https://github.com/n8n-io/n8n/commit/3ba050819a8a45080f7cbe317949eaff55022d26

Fix got released with [email protected]

I’m having the same error, but using POST instead of GET:

I’ve tried both with body parameters and raw JSON, but the problem persists.

The API I’m trying to use is GitHub - Invoiced/invoice-generator-api: A free API for generating invoice PDFs and e-Invoices. which generates a PDF.

If you want to reproduce the problem, you can create a HTTP node with these parameters:

  • Request Method: POST
  • URL: https://invoice-generator.com
  • Response Format: File
  • Body Parameters:
    • from: “My Company”
    • to: “Your Company”
    • date: “1/1/2020”
    • items[0][name]: “My Product”
    • items[0][quantity]: 1
    • items[0][unit_cost]: 99

Or you can use this raw JSON:

{
    "from": "My Company",
    "to": "Your Company",
    "date": "1/1/2020",
    "items": [
        {
            "name": "My Product",
            "quantity": 1,
            "unit_cost": 99
        }
    ]
}

Those requests work fine using Postman. I’m using v0.88.1.

Yes sorry, that was another bug for the combination of “responseFormat” → “file” with sending POST-Data. Got fixed and will be released with the next version:
https://github.com/n8n-io/n8n/commit/4165fad307a4f5460750dce7429e9f0f690d460b

The only workaround, until the next version got released, would be to set “JSON/RAW Parameters” to true and then JSON.stringify the data in the “Body Parameters”.

Thanks for the fix @jan :+1:

I was not able to make it work with that workaround, though. It looks like even if I’m able to turn the object into a string in the previous step, it turns back into an object again when the expression is analyzed:

If that doesn’t have an easy solution, don’t worry, I’ll wait for the update :slight_smile:

Fix got released with [email protected]

So no more need for the workaround.

1 Like

Working perfectly now. Thanks @jan!!

Glad to hear! Have fun!