Upload videos to YouTube

Describe the issue/error/question

Heya, I am working on a workflow that uploads Zoom Recordings to YouTube. I’ve been successfully able to complete the first step, however, I am having issues with the second part: Upload Video to YouTube. The workflow crashes after executing the YouTube node for a while.

What is the error message (if any)?

There was a problem executing the workflow:
"Workflow execution process did crash for an unknown reason!"

Please share the workflow

(Select the nodes and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow respectively)

Share the output returned by the last node

The last node downloads the video from Zoom and returns the binary file.

Information on your n8n setup

  • n8n version: 0.167.0
  • Database you’re using (default: SQLite):
  • Running n8n with the execution process [own(default), main]:
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]:

Let me know if you need more information :slight_smile:

2 Likes

Hey @harshil1712, looks like you forgot to share a workflow using which your problem can be reproduced and also didn’t share how you are currently running n8n (docker/desktop/cloud etc.).

That said, I suspect this might be related to the memory consumption of your workflow. Videos tend to be huge and running such a workflow would require loads of memory on your end. As a first step you could try setting the environment variable N8N_DEFAULT_BINARY_DATA_MODE=filesystem. This will mean binary data is held on the filesystem rather than in memory, but it’s not a guarantee for success.

If this doesn’t work, could you double-check your server logs for any possible hints?

1 Like

Hey @MutedJam,

Thanks for getting back to me! I can’t share the whole workflow, but I here’s the YouTube node:

I am assuming the instance is running via docker, but I’ll get back with more information. Also, thanks for sharing the env variable. That skipped my mind. I’ll test it out and let you know if it works or not.

1 Like

Hey @MutedJam,

We already have the env setup and now I am finally getting some response (error) from the YouTube node. Below is the error message that the node throws:

ERROR: UNKNOWN ERROR - check the detailed error for more information
Invalid array length

Stack

NodeApiError: UNKNOWN ERROR - check the detailed error for more information
    at Object.googleApiRequest (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/YouTube/GenericFunctions.js:24:15)
    at Object.execute (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/YouTube/YouTube.node.js:597:84)
    at async /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:451:47

There’s no other error message. I’ll try to get log output if needed.

Hey @harshil1712, so I gave uploading a video via YouTube a go and didn’t run into any trouble with this workflow:

So it very much seems this is would be a problem with your specific scenario I am afraid. If you could provide some more detailed steps on how to reproduce your problem that would be great.

1 Like

Hey @MutedJam,

The instance is running via PM2 with queue mode. I tried executing the workflow again, and this time I got a different error: 413 (payload too large). The Upload API docs mention that the video size up to 256GB should be fine, and the video I am trying to upload is way less than 256 GB. So I am not sure why the node is throwing this error.

Here’s the error log:

PayloadTooLargeError: request entity too large
    at readStream (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/raw-body/index.js:155:17)
    at getRawBody (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/raw-body/index.js:108:12)
    at read (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/body-parser/lib/read.js:77:3)
    at jsonParser (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/body-parser/lib/types/json.js:135:5)
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/dist/src/Server.js:272:13
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at compression (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/compression/index.js:220:5)
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/dist/src/Server.js:266:13

PayloadTooLargeError: request entity too large
    at readStream (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/raw-body/index.js:155:17)
    at getRawBody (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/raw-body/index.js:108:12)
    at read (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/body-parser/lib/read.js:77:3)
    at jsonParser (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/body-parser/lib/types/json.js:135:5)
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/dist/src/Server.js:272:13
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at compression (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/compression/index.js:220:5)
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/dist/src/Server.js:266:13
PayloadTooLargeError: request entity too large
    at readStream (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/raw-body/index.js:155:17)
    at getRawBody (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/raw-body/index.js:108:12)
    at read (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/body-parser/lib/read.js:77:3)
    at jsonParser (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/body-parser/lib/types/json.js:135:5)
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/dist/src/Server.js:272:13
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at compression (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/compression/index.js:220:5)
    at Layer.handle [as handle_request] (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:323:13)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:341:12)
    at next (/home/n8n/.nodejs_global/lib/node_modules/n8n/node_modules/express/lib/router/index.js:275:10)
    at /home/n8n/.nodejs_global/lib/node_modules/n8n/dist/src/Server.js:266:13

Update:

I tested executing the workflow in two separate ways and ended up getting similar results with different errors.

  1. Manually execute the Download Video node first. After its successful execution, execute the next node. This results in a 413 error.

  2. Delete the current execution, and instead of executing the Download Video node, execute the succeeding node. The Download Video node executes successfully, but the instance crashes with an error: "Workflow execution process did crash for an unknown reason!"

Hey @MutedJam,

I updated the N8N_PAYLOAD_SIZE_MAX env, and it solves the above issue. But it still doesn’t upload the video on YouTube. The YouTube node throws the Invalid array length error. For this error, there are no logs.

I tested out with this video, and ran into maxBodyLength Limit error. However, this seems to be solvable by adding a Max Body Lenght parameter. But again, the node misses that parameter.

Is there anything else that I can do to solve this? I thought of using the request library inside the Function node, but since the YouTube API only allows OAuth authentication, that solution would also not work. Would really appreciate any help :slight_smile:

2 Likes

Hey @harshil1712, glad to hear you figured out the right setting for the 413 and thx for providing this example. I’ll take a look and see if I can reproduce the problem with it.

Just a quick update on this one: This has been added to our internal bug tracker and is currently awaiting a fix.

1 Like

Thanks, Tom! Appreciate it :slight_smile:

Fix got released with [email protected]