How can I change the memory limit in n8n?

Tried with the 0.217.2, and the config file setted with the command above, same error

I am running this setup:
local host with npm version 0.217.2
edited config file with:

{
	"N8N_AVAILABLE_BINARY_DATA_MODES":"filesystem"
}

and lunched n8n with the following command:

NODE_OPTIONS="--max_old_space_size=4096" n8n start

I think I know what the problem is, When I was going through the env doc quickly this morning I sent the wrong key.

Can you remove the N8N_AVAILABLE_BINARY_DATA_MODES option and set N8N_DEFAULT_BINARY_DATA_MODE to filesystem

I’ve tried to run n8n with this option

"N8N_DEFAULT_BINARY_DATA_MODE":"filesystem"

But still get the same error:
ERROR: Cannot create a string longer than 0x1fffffe8 characters

Did you remove the option as well? I have just tested this on a clean install of n8n and I get the below

Can you share all of the n8n options you have set with anything important removed along with how you are launching n8n so I can test that as well?

This is all my config file:

{
	"encryptionKey": "<REDACTED>",
	"N8N_DEFAULT_BINARY_DATA_MODE":"filesystem"
}

I am lunching n8n through terminal:

 NODE_OPTIONS="--max_old_space_size=4096" n8n start

So I think the problem there is I am not sure you can set the option in that config file but the config option name is wrong if that is the approach you want to take.

I would just do…

N8N_DEFAULT_BINARY_DATA_MODE=filesystem n8n start

You don’t need the node option anyway so might as well remove that. If you did want to use a config file I would make a file called n8n-config.json under the users home dir (~/) and put in something like this…

{
 "binaryDataManager": {
  "mode": "filesystem"
 }
}

Then start n8n with…

export N8N_CONFIG_FILES=~/n8n-config.json
n8n start

With this last solution i am getting this error:

ERROR: promises_1.default.cp is not a function

Is there any more to the error?

TypeError: promises_1.default.cp is not a function
    at BinaryDataFileSystem.copyFileToLocalStorage (/opt/homebrew/lib/node_modules/n8n/node_modules/n8n-core/src/BinaryDataManager/FileSystem.ts:239:12)
    at BinaryDataFileSystem.copyBinaryFile (/opt/homebrew/lib/node_modules/n8n/node_modules/n8n-core/src/BinaryDataManager/FileSystem.ts:59:14)
    at BinaryDataManager.copyBinaryFile (/opt/homebrew/lib/node_modules/n8n/node_modules/n8n-core/src/BinaryDataManager/index.ts:58:23)
    at Object.execute (/opt/homebrew/lib/node_modules/n8n/node_modules/n8n-nodes-base/nodes/Ftp/Ftp.node.ts:606:53)
    at Workflow.runNode (/opt/homebrew/lib/node_modules/n8n/node_modules/n8n-workflow/src/Workflow.ts:1270:19)
    at /opt/homebrew/lib/node_modules/n8n/node_modules/n8n-core/src/WorkflowExecute.ts:949:29

I was thinking about that the problem of this error:
ERROR: Cannot create a string longer than 0x1fffffe8 characters
Is to create a string in n8n, so there is a way to split the creation of the string in batch?

Hey @Gabriele_Bracciali,

The issue is when using memory mode for the files it is limited to 512MB as defined by NodeJS, The recommended solution to this is to use data streams which is what we have implemented and what has worked fine during testing.

I guess the issue now will be trying to work out why this isn’t working in your environment so a bit more testing is going to be needed.

When you installed n8n how did you do that was it just an npm install -g n8n or did you use the brew version?

I’ve used this command
npm install -g n8n

P.S: Just see right now that the file I want to download is 400mb c.a

What version of node are you running?

n8n/0.217.2 darwin-arm64 node-v14.21.3

Alright, Lets start by getting you up to node 16 which is our recommended version

Okay, I’ve updated it at 16.7
And now it’s working like expected, runned with the command

export N8N_CONFIG_FILES=~/n8n-config.json
n8n start

2 Likes

Hey @Gabriele_Bracciali,

That is fantastic news, I was out of other ideas :smiley:

1 Like

Thank you @Jon for your help!

1 Like

No problem at all @Gabriele_Bracciali, I am glad we got to the bottom of it.

2 Likes