GET request to large XML file gives error "Cannot create a string longer than 0x1fffffe8 characters"

Describe the problem/error/question

I am using the HTTP Request node to fetch a large XML file (~1 GB) from a URL. This fails with error message “Cannot create a string longer than 0x1fffffe8 characters”.

I did see other similar posts in the community suggesting N8N_DEFAULT_BINARY_DATA_MODE=filesystem should fix it, but this does not help.

I’m on Self Hosted version 1.70.3 with the following docker-compose config:

Screenshot 2024-12-09 at 11.08.00

What is the error message (if any)?

Cannot create a string longer than 0x1fffffe8 characters

n8n version: 1.70.3 (Self Hosted)

Stack trace:

Error: Cannot create a string longer than 0x1fffffe8 characters at Object.slice (node:buffer:633:37) at Buffer.toString (node:buffer:861:14) at Object.binaryToString (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/NodeExecuteFunctions.js:581:19) at processTicksAndRejections (node:internal/process/task_queues:95:5) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:584:42) at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:732:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:716:51 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1147:20

Please share your workflow

I can’t share the URL to the XML file publicly here, but flow is this:

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.70.3
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Debian 12 x64

docker-compose file:

version: "3.8"
services:
  n8n:
    image: docker.n8n.io/n8nio/n8n:1.70.3
    restart: always
    environment:
      - N8N_HOST=${N8N_HOST}
      - N8N_PORT=${N8N_PORT}
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${N8N_HOST}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
      - N8N_SECURE_COOKIE=false
      - N8N_DEFAULT_BINARY_DATA_MODE=filesystem
    volumes:
      - n8n_data:/home/node/.n8n

volumes:
  n8n_data:

hi @JesperCodes.com

Sorry for the late response here. It looks like the file is too large indeed, I made a quick search online and found this stackoverflow thread talking about the same: javascript - Cannot create a string longer than 0x1fffffe8 characters in JSON.parse? - Stack Overflow

Are you able to reduce the file size somehow or split it into several requests?

No, I’m not. It’s from an external source which I do not manage.

I have solved it for now by creating a web app in Go that will download and parse the XML for me, and then I request the Go app from my n8n workflow instead.

2 Likes

Thanks for sharing back the details. Glad you found a workaround :slight_smile:

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