Axios httpRequest giving ERROR code 500

Describe the issue/error/question

I need to make a multipart request. For testing purpose I have created a code node using axios request. When executing the node I get an error. Posting the same via Postman is working. The error is created whatever content I put into the JSON.
console.log(options) is working and seems to be the correct JSON structure
console.log(response) is not showing anything.
Any ideas?

What is the error message (if any)?

Error: Request failed with status code 500
    at createError (C:\Users\offic\AppData\Local\Programs\n8n\resources\app\node_modules\axios\lib\core\createError.js:16:15)
    at settle (C:\Users\offic\AppData\Local\Programs\n8n\resources\app\node_modules\axios\lib\core\settle.js:17:12)
    at IncomingMessage.handleStreamEnd (C:\Users\offic\AppData\Local\Programs\n8n\resources\app\node_modules\axios\lib\adapters\http.js:269:11)
    at IncomingMessage.emit (node:events:406:35)
    at IncomingMessage.emit (node:domain:470:12)
    at endReadableNT (node:internal/streams/readable:1331:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

Please share the workflow

const options =  {
  url: "",
  headers: {
    "Authorization": 'xxxxx',
    "Content-Type": "application/json"
    "voucher": {
      "supplier": {
        "id": 54106494,
        "objectName": "Contact"
      "supplierName": "ÖGK",
      "description": "Auszahlungsjournal",
      "status": 50,
      "creditDebit": "C",
      "voucherType": "VOU",
      "paymentDeadline": null,
      "objectName": "Voucher",
      "mapAll": "true",
      "taxType": "default"
    "voucherPosSave": [
        "accountingType": {
          "id": 58,
          "objectName": "AccountingType"
        "taxRate": 20,
        "sum": null,
        "isAsset": "false",
        "objectName": "VoucherPos",
        "net": "true",
        "mapAll": "true",
        "taxType": "ss",
        "creditDebit": "D",
        "hidden": "0",
        "costCentre": {
          "id": 101640,
          "objectName": "CostCentre"
    "voucherPosDelete": null,
    "filename": "7bec61fff8008c874f5b19d5d9cc5d11.pdf"
  method: "POST"

const response = await this.helpers.httpRequest(options);
return this.prepareOutputData(response);

Share the output returned by the last node

Information on your n8n setup

  • n8n version: Desktop app for Windows 1.7.0
  • Database you’re using (default: SQLite): default

Hi @pghahrem, unfortunately I don’t have access to the API you are sending data to, so am not sure how the request should look like. I’d avoid using custom code for HTTP requests whenever possible as n8n does have a node for this.

That said, the request you are making should work in principle, I’ve just tested the below workflow on the current desktop version of n8n:

The request also arrives on the server as expected (I’ve used a URL provided by to test this):

So, perhaps you can take a closer look at the requests made by Postman and n8n? You could consider using as well here to easily inspect each of them.

Hi @MutedJam, thanks for analysis. is a very good hint. I will check that. In the meanwhile I managed to connect the API correctly via HTTP request.

1 Like

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