N8n crashes when using HTTP node with Body settings: JSON/Using JSON

Describe the problem/error/question

When using the HTTP node with body settings of JSON/Using JSON, n8n crashes and needs to be brought down and back up. If I instead use Raw, it works. See attached workflow nodes with CRASHES vs WORKS HTTP node configurations and the provided docker error log.

What is the error message (if any)?

UI: Lost Connection
Log: n8n_1 | 2023-04-10T16:42:44.435170671Z TypeError: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object

Please share your workflow

Share log output

Log output from sudo docker-compose logs -ft:

traefik_1  | 2023-04-10T16:34:04.894688094Z time="2023-04-10T16:34:04Z" level=info msg="Configuration loaded from flags."
n8n_1      | 2023-04-10T16:42:44.435112629Z /usr/local/lib/node_modules/n8n/dist/ErrorReporting.js:59
n8n_1      | 2023-04-10T16:42:44.435152310Z             throw error;
n8n_1      | 2023-04-10T16:42:44.435159490Z             ^
n8n_1      | 2023-04-10T16:42:44.435165121Z 
n8n_1      | 2023-04-10T16:42:44.435170671Z TypeError: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object
n8n_1      | 2023-04-10T16:42:44.435176351Z     at new NodeError (node:internal/errors:387:5)
n8n_1      | 2023-04-10T16:42:44.435181921Z     at write_ (node:_http_outgoing:843:11)
n8n_1      | 2023-04-10T16:42:44.435187031Z     at ClientRequest.write (node:_http_outgoing:808:15)
n8n_1      | 2023-04-10T16:42:44.435191951Z     at Request.write (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:1494:27)
n8n_1      | 2023-04-10T16:42:44.435196811Z     at end (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:549:18)
n8n_1      | 2023-04-10T16:42:44.435201811Z     at Immediate.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:578:7)
n8n_1      | 2023-04-10T16:42:44.435207311Z     at processImmediate (node:internal/timers:466:21)
n8n_1      | 2023-04-10T16:42:44.435211752Z     at process.topLevelDomainCallback (node:domain:161:15)
n8n_1      | 2023-04-10T16:42:44.435216112Z     at process.callbackTrampoline (node:internal/async_hooks:128:24) {
n8n_1      | 2023-04-10T16:42:44.435221552Z   code: 'ERR_INVALID_ARG_TYPE'
n8n_1      | 2023-04-10T16:42:44.435226432Z }
traefik_1  | 2023-04-10T16:42:44.456474174Z 2023/04/10 16:42:44 reverseproxy.go:490: httputil: ReverseProxy read error during body copy: unexpected EOF
traefik_1  | 2023-04-10T16:42:44.456839702Z 2023/04/10 16:42:44 reverseproxy.go:490: httputil: ReverseProxy read error during body copy: unexpected EOF
traefik_1  | 2023-04-10T16:42:44.456874193Z 2023/04/10 16:42:44 reverseproxy.go:490: httputil: ReverseProxy read error during body copy: unexpected EOF
n8n_1      | Last session crashed

Information on your n8n setup

  • n8n version: 0.222.1 (also occurs with 0.213.0)
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: main):
  • Running n8n via (Docker):
  • Operating system: Ubuntu 22.04.2 LTS

Hi @jamesword, I am sorry you’re having trouble.

I just gave this a go on my end (with the only thing I’ve changed being the credentials and the sheet ID), but didn’t run into the problem:

That said, I do know @netroy has worked on improving our binary data handling a while back and I wonder if this could be related to the chunk error you are seeing. @netroy, any chance you can help here?

@jamesword, perhaps you can share your full docker compose config in the meantime (secrets can of course be redacted, just want to get an idea of how exactly you have set up your n8n instance)?

@jamesword The stack trace suggests that the request module was used instead of axios for making the http call.
Do you by any chance have the N8N_USE_DEPRECATED_REQUEST_LIB env variable set?

I ran into the same issue today. Indeed, there was N8N_USE_DEPRECATED_REQUEST_LIB set. Therefore, I can confirm that deleting this env will fix the problem.

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