Passing args to n8n via

In the package.json, i have

"n8n": "dotenv cross-env N8N_ENCRYPTION_KEY=%N8N_ENCRYPTION_KEY% && cross-env EXECUTIONS_DATA_PRUNE=true && cross-env EXECUTIONS_DATA_MAX_AGE=168 && cross-env N8N_USER_MANAGEMENT_DISABLED=true && cross-env N8N_METRICS=true && n8n start",

But it seems EXECUTIONS_DATA_PRUNE is not having any effect: after a months of running, I see 20K workflows executions and 1Gb database.

PS: as a secondary question: sometimes I get “EBUSY: resource busy” error on start. Several restarts helps, but it would be nice to fix it as well.

I use n8n v 0.209.4 on Windows 10 VDS.

Actually, funny thing, i cant clear executions via the website: it just hangs forever.
If to reload the website, it shows 0 executions. But if to restart n8n and reload the website, i see 20k executions again.

Can you share a bit more on how you running n8n? I don’t recognise what you are doing, like what are you doing with dotenv and why the package.json?

Yeah, sure.

So, i have a couple of VDS’es i utilize, so i’ve made this project to sync the local changes with VDS: [n8n-workbench-syncer] Syncing local n8n workflows with remote host - #4 by yavetal

Dotenv reads the encryption key from the .env, and cross-env just pushes other env values, e.g. EXECUTIONS_DATA_PRUNE=true (well, at least it supposed to do so). And package.json is used in order to keep other syncing and running scripts in one place.
Here’s full package.json: n8n-workbench-syncer/package.json at main · Systemify-me/n8n-workbench-syncer · GitHub

Have any of the environment options set? It kind of feels like the issue could be with the startup command being used, I would be tempted to just a config file for all the options and pass that in as an option instead and see if that helps.

Yeah, sounds like a workaround, thanks!

The issue is super easy to reproduce, if anyone is up to: just grab that package.json ( n8n-workbench-syncer/package.json at main · Systemify-me/n8n-workbench-syncer · GitHub ), throw it to the empty folder, and run:
npm i (might take a couple of minutes)
npm run n8n

Actually, I just did that on fresh system - and when i open browser with n8n, i see login and password requirement. That means n8n had missed N8N_USER_MANAGEMENT_DISABLED=true.

Oh, i’ve found similar approach: How to pass the host name from env file to nodes?

And here’s the answer:

With bash, &&totally isolates one script from another, socross-env can't spawn the rest of your command because it's isolated from it.

Ahh, this is so stupid. i shouldn’t even had to create this thread.

But in case someone else is stuck with similar issue, here’s proper command - I don’t see login prompt when running n8n via:

"n8n": "dotenv cross-env N8N_ENCRYPTION_KEY=%N8N_ENCRYPTION_KEY% EXECUTIONS_DATA_PRUNE=true EXECUTIONS_DATA_MAX_AGE=168 N8N_USER_MANAGEMENT_DISABLED=true N8N_METRICS=true n8n start",

(I’ll update my workbench today later on)

1 Like

Ah nice to see you cracked it :slight_smile:

1 Like

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