Youtube Node Request failed with status code 413

When i am trying to upload a video to youtube getting error says that Request failed with status code 413

Information on your n8n setup

  • **Running n8n via npm

if changing N8N_PAYLOAD_SIZE_MAX will solve this issue? how can i change this value

Hi @jaisonkerala1, N8N_PAYLOAD_SIZE_MAX is an environment variable. So how you’d go about changing it would depend on how you have deployed n8n and which operating system you are using. Assuming you have installed n8n globally via npm on a Linux machine, the simplest way of doing so would be running N8N_PAYLOAD_SIZE_MAX=512 n8n start.

got response like this ? what should i do

[email protected]:~# npx pm2 N8N_PAYLOAD_SIZE_MAX=512 n8n start
npx: installed 183 in 33.605s
[PM2][ERROR] Command not found

usage: pm2 [options] <command>

pm2 -h, --help             all available commands and options
pm2 examples               display pm2 usage examples
pm2 <command> -h           help on a specific command

Access pm2 files in ~/.pm2
[email protected]:~#
[email protected]:~# npx N8N_PAYLOAD_SIZE_MAX=512 n8n start
/usr/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:296
      throw invalidTagName(spec)
      ^

Error: Invalid tag name "N8N_PAYLOAD_SIZE_MAX=512": Tags may not have any characters that encodeURIComponent encodes.
    at invalidTagName (/usr/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:91:15)
    at fromRegistry (/usr/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:296:13)
    at resolve (/usr/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:81:12)
    at npa (/usr/lib/node_modules/npm/node_modules/npm-package-arg/npa.js:52:10)
    at fastPathArgs (/usr/lib/node_modules/npm/node_modules/libnpx/parse-args.js:105:17)
    at Function.parseArgs (/usr/lib/node_modules/npm/node_modules/libnpx/parse-args.js:11:12)
    at Object.<anonymous> (/usr/lib/node_modules/npm/bin/npx-cli.js:8:9)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  code: 'EINVALIDTAGNAME'
}

i am running n8n on npm on ubuntu

i even tried with n8n command node

Stack
NodeOperationError: Command failed: N8N_PAYLOAD_SIZE_MAX=512 n8n start

    at Object.execute (/home/jaison/.nodejs_global/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/ExecuteCommand/ExecuteCommand.node.js:76:27)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at async Workflow.runNode (/home/jaison/.nodejs_global/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:619:28)
    at async /home/jaison/.nodejs_global/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:557:53

Hi @jaisonkerala1, are you running n8n via pm2 while running pm2 itself via npx? In general, the environment variables you want to set would come before your command. Similar to the command I’ve shared earlier, or something like N8N_PAYLOAD_SIZE_MAX=512 npx [email protected] when using npx instead.

With pm2 I things might be a bit trickier. I am not very familiar with it, but other reports on this forum have suggested an ecosystem file could do the job. Check out their documentation for more information on how to use these.

i tried yesterday something similar to this after that one or three times video was uploading (only if delete current execution data), after that something unexpected happened. in my host, i am only having 20 GB Disk space before the used space was 8.9 GB yesterday after changing this setting ( i don’t know it worked or not but video was not uploading ) my diskspace became 19.5 GB. an you explain why this is happening ? , and now i restored my backup and it became 8.5 GB as it was before

can you please explain this ?

  1. if i open a command nod in n8n and execute this command will it work ?

3.if i change the memory will it became a diskspace loss ?

  1. how to know this method is working or not because i am afraid try to upload videos from yesterday
  1. if i open a command nod in n8n and execute this command will it work ?

No. The example commands provided will start n8n using the environment variable, they aren’t mean to be used in the Execute Command node.

3.if i change the memory will it became a diskspace loss ?

n8n will persist execution data in a database which is stored on your hard drive by default. Running workflows processing large amounts of data will cause disk space to be used for this reason. The setting N8N_PAYLOAD_SIZE_MAX itself will have no direct impact on the disk space. Check out Execution data - n8n Documentation for more details on how to enable data pruning in n8n.

  1. how to know this method is working or not because i am afraid try to upload videos from yesterday

You can read any environment variable through an expression such as {{ $env["N8N_PAYLOAD_SIZE_MAX"] }}. Running the below workflow in an n8n instance started using N8N_PAYLOAD_SIZE_MAX=512 npx [email protected] should return a value of 512:

Just keep in mind that the exact way of setting environment variables will depend on how you have deployed n8n. So far it is not clear to me how that’s happening.

Now This is what i am getting. before i am going to execute one more thing that is where should i run this command as a user or as root and is this the proper command i shown below ?

N8N_PAYLOAD_SIZE_MAX=512 npx [email protected]

Here i am assuming that @latest equals @n8n version
is this correct ?

The command looks fine (though it’s just one of many possible ways to run n8n), though it would start n8n on the local machine it is entered on, listening at http://localhost:5678.

How exactly did you deploy on console.opendream.in?

i installed by following How to set up n8n via PM2 – n8n Blog
also using ngnix

Have you tried using the command from the environment variable section of blog post on your server? So something like N8N_BASIC_AUTH_ACTIVE=true N8N_BASIC_AUTH_USER=<USERNAME> N8N_BASIC_AUTH_PASSWORD=<PASSWORD> N8N_PAYLOAD_SIZE_MAX=512 pm2 restart n8n --update-env (or the configuration file version just below)?

in blog post there is ony

N8N_BASIC_AUTH_ACTIVE=true N8N_BASIC_AUTH_USER=<USERNAME> N8N_BASIC_AUTH_PASSWORD=<PASSWORD> pm2 restart n8n --update-env

so now what should i do

1.go with N8N_PAYLOAD_SIZE_MAX=512 npx [email protected]

2.try editing env file ( i am not sure the location of env file if i should try this i am expecting a little help )

in blog post there is ony

You’d simply add any additional environment variables to the command, like in the example I have posted:

N8N_BASIC_AUTH_ACTIVE=true N8N_BASIC_AUTH_USER=<USERNAME> N8N_BASIC_AUTH_PASSWORD=<PASSWORD> N8N_PAYLOAD_SIZE_MAX=512 pm2 restart n8n --update-env

If you decide to go with a configuration file instead the exact file location would depend on where you have created the file.

-bash: pm2: command not found

That sounds like you’re not using pm2 then or would need to specify an absolute path to the respective binary and is unrelated to the actual problem.

So before continuing here you’d need to find out exactly how n8n runs on your webserver. What do you usually do when updating n8n? How exactly do you pull and start the latest version?

if i use npx command it is working i guess

this is what happening now

Untitled

This would be pm2 telling you it isn’t aware of a running process named n8n, suggesting n8n isn’t managed by pm2 on your machine.

should i install pm2 or keep it as it is ?