Load function code from external source

I like to use VS code, it would be nice to be able to have the function node load the code from a file on the server so it can be edited and updated outside of the web interface

Hi @wgicio,

the environment NODE_FUNCTION_ALLOW_EXTERNAL (Environment variables - n8n Documentation) is not an option for you? Yes, you have to import your code as npm package first - every time you install n8n - but for me this is enough so far.

For the import process I have also created a workflow in n8n, which also restarts n8n immediately. However, I use n8n with npm (on linux with nvm and pm2) and not in the cloud or as docker.

:thinking:
You might be able to use the github node to retrieve the function code and insert that into the function node. There is a execute function option that might work with this.
I have never tried it though so it working is about a 50/50 chance. Might be good to try it out though.

1 Like

good idea, I will have a test when I get a chance

1 Like

The code of the Function-Node can also be an expression. So you can read code from GitHub, File, RabbitMQ, … and then reference it via an expression.
You should obviously trust the source of the data as it will open up a huge security whole.

4 Likes