Failed to asynchronously prepare wasm: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory

Describe the issue/error/question

Hello all,

I try to install N8N on my server, everything seems to have worked but when I launch N8N via the terminal I get error after a few seconds

I have 2.5go RAM available on my server

What is the error message (if any)?

n8n
Initializing n8n process
query is slow: CREATE TABLE IF NOT EXISTS webhook_entity ("workflowId" integer NOT NULL, "webhookPath" varchar NOT NULL, "method" varchar NOT NULL, "node" varchar NOT NULL, PRIMARY KEY ("webhookPath", "method"))execution time: 4829failed to asynchronously prepare wasm: RangeError: WebAssembly.instantiate(): Out of memory: wasm memory[RangeError: WebAssembly.instantiate(): Out of memory: wasm memory]
...
B+na}function pa(){var a=W;try{if(a==W&&J)return new Uint8Array(J);var c=H(a);if(c)return c;if(E)return E(a);throw"both async and sync fetching of the wasm failed";}catch(d){K(d)}}
                                                    ^

RuntimeError: abort(RangeError: WebAssembly.instantiate(): Out of memory: wasm memory). Build with -s ASSERTIONS=1 for more info.
    at K (/home/elena/.npm-global/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/crypto/poly1305.js:19:53)
    at /home/elena/.npm-global/lib/node_modules/n8n/node_modules/ssh2/lib/protocol/crypto/poly1305.js:26:385

Thanks for your help ! :slight_smile:

Hi @djimmy, welcome to the community :tada:

I am very sorry to hear you’re encountering this behaviour. Could you share some additional details? How are you installing n8n? Which database are you using?

Hello !

I followed the documentation here.
I installed N8N via NPM without specifying a db …

Hey @djimmy, many thanks for confirming. Have you tried running n8n through another method such as docker? Just to rule out any possible causes in your current environment? The example command at Docker Installation | Docs would provide a quick way of testing this.

My host prevents me from installing docker for security reasons. And I would like not to have to rent a new server to install n8n …

Hi @djimmy,

The error message suggests there is not enough memory available to execute the WebAssembly.instantiate() function (which seems to come from the ssh2 module used by n8n).

This is odd seeing n8n usually runs with very little memory and I have successfully started it on potato machines in the past. In fact, to verify this is not a general problem with n8n or its dependencies I have just set up a very small free VM on Oracle Cloud with just 1 GB of RAM. I then first installed Node.js 14 and afterwards installed n8n and launched it like so (which is what I believe you mean were doing based on your description):

npm install n8n -g
n8n

This took a bit longer than it does on a more powerful machine but I was eventually greeted with the expected output:

So It very much seems this comes down to the specific environment you are running n8n in. Are you sure there is sufficient memory left when installing and starting n8n? What does the htop output look like during the process?

Thank you for your help!
It was a problem of ram blocked by my host indeed! :+1:

I just launched n8n, but I have several questions.

I assume you are using your server’s IP or public domain name instead of localhost in your browser, right?

If so, this could suggest a firewall in front of your server not letting web traffic on port 5678 through. You could double check whether n8n answers by running curl http://localhost:5678 on your server which should return a response like this (or some HTML if you’re not using basic auth):

image

In a typical server environment, you’d have a reverse proxy in front of n8n (and possibly other apps listening on their own ports) that accepts SSL/TLS-encrypted web traffic on a domain like n8n.djimmy.com and then forwards it to the local port 5678.

This is what the server setup part in our documentation describes (though it wouldn’t be applicable for you since it users docker).

As an alternative you might want to take a look at this blog post:

In it, @harshil1712 describes a docker-free set up using PM2 (to keep n8n always running as you suggested) and Nginx (a widely used web server that also works great as a reverse proxy).

I confirm that I am trying to connect via my public ip.
Via a curl I have a refused connection … :point_down:
curl: (7) Failed connect to publicip:5678; Connexion refused

The port is closed and I can’t open it.

Do you know if it is possible to change the listening port? If so, which one can I use?

Thank you very much for your help !

Via a curl I have a refused connection … :point_down:
curl: (7) Failed connect to publicip:5678; Connexion refused

Sounds like you are running curl on your local machine. Is it working on the server running n8n?

The port can be changed by setting the N8N_PORT environment variable.

No no, it’s on the server that runs n8n :slight_smile :
I’ll contact my host to see which port is open so I can change it !
Thank you very much for your help !