Is there a way to include or exclude custom nodes that are added in .n8n folder using NODES_INCLUDES or NODES_EXCLUDES environment variable

Is there a way to include or exclude custom nodes that are added in .n8n folder using NODES_INCLUDES or NODES_EXCLUDES environment variable

When I tried adding the custom node to these environment variables, the container keeps on crashing.

I run n8n in docker.

That is a good question and I do unfortunately not know the answer to that. Perhaps @marcus knows more.

In general, could you please make sure to provide all relevant information when opening a new topic here on the forum? There’s a template for this and it’ll greatly simplify things for everyone trying to help.

1 Like

Hi,
Is there any update on the above topic ?

Regards
Mahesh

Hi,

The Custom nodes cannot be included in the NODES_INCLUDE or EXCLUDE docker property. If we add our Custom node types into this, then a error will be thrown in LoadNodesAndCredentials.ts file postProcessLoaders method. The error is due to the Claaname and sourcePath will be undefined in known.nodes. So I provided a temporary fix in my local but its not very ideal. But it works for me as of now.

In runDiectoryLoader function if the loader is a instaceof CustomDirectoryLoader then I will reinitialize the loader Object by passing empty arrays into the constructor for node_includes and node_excludes.

This solves the problem temporarily. Please let me know your thoughts on this.

Hey @Mahesh_Thiru,

I am a bit confused by this one, What are you actually trying to do? If you are using a custom image or manually installing nodes into the ~/.n8n/nodes folder wouldn’t the best solution be to either install them or not install them rather than using the env option?

1 Like

Hi @Jon.
Thats correct. I believe, its not how n8n works now. I am installing a custom node in .n8n/custom and also I want to restrict some of the base nodes that were getting displayed in the n8n, then the custom nodes also go missing.

Hey @Mahesh_Thiru,

Which build in nodes are you excluding? I can give it a test here to see if I have the same issue.

@Jon,
Please find the details below.

In Docker compose file :

  • NODES_INCLUDE=[“n8n-nodes-base.gmailTrigger”,“n8n-nodes-base.gmail”,“n8n-nodes-base.quickbooks”,“n8n-nodes-base.googleSheets”,“n8n-nodes-base.slack”,“n8n-nodes-base.chargebeeTrigger”,“n8n-nodes-base.hubspot”,“n8n-nodes-base.chargebee”,“n8n-nodes-base.httpRequest”,“n8n-nodes-base.if”,“n8n-nodes-base.code”,“n8n-nodes-base.set”,“n8n-nodes-base.merge”,“n8n-nodes-base.emailSend”,“n8n-nodes-base.dateTime”,“n8n-nodes-base.webhook”,“n8n-nodes-base.hubspotTrigger”,“n8n-nodes-base.manualTrigger”,“n8n-nodes-base.scheduleTrigger”]

In Custom folder at /home/.n8n/custom, Please USe HttpBin node that comes along with the n8n-starter-node

Regards.

Hey @Mahesh_Thiru,

That is perfect and shows the actual problem. I will get a dev ticket created so that we can look at fixing that.

1 Like

Thank you @Jon. Can you please review my solution. In LoadNodesAndCredentials.ts, in runDirectoryLoader method

let loader = new constructor(dir, this.excludeNodes, this.includeNodes);
if(loader instanceof CustomDirectoryLoader) {
loader = new constructor(dir, [], []);
}

Hey @Mahesh_Thiru,

I have created N8N-6225 as the internal ticket for this one, What you are doing might work but it may not be the option we take so I would say if it works ok for you run with it but don’t be surprised if we did something different when we change it.

Yes @Jon. I agree. This is just a temporary solution. Thank you for the information. Also, I will revert this, when I have a permanent fix from you guys.

Thank you again.

1 Like

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