Struggling with versioning of custom nodes. Need advice

Describe the issue/error/question

I just started with custom nodes. I cloned the n8n-nodes-starter and deleted everything but the ExampleNode. Then I read the docs about full versioning and tried to build a V1 version of my ExampleNode using the linked example Mattermost Node.

I fixed all the lint warning, ran npm run build and copied the content of ./dist/ into my local n8n folder ~/.n8n/custom.

Here is a link to my repository with the dist folder included: https://github.com/cauterize/n8n-custom-node-poc

At first glance everything seemed fine. I can find my ExampleNode in the Sidebar. But if I try to drag in in my Workflow I get the following error:

What is the error message (if any)?

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'version')
    at index.3234c9ef.js:110:55958
    at Array.forEach (<anonymous>)
    at s.loadNodesProperties (index.3234c9ef.js:110:55922)
    at s.addNodes (index.3234c9ef.js:110:51611)
    at s.injectNode (index.3234c9ef.js:110:33839)
    at async s.addNode (index.3234c9ef.js:110:34938)

Here are the corresponding code lines, where the error is thrown:

async loadNodesProperties(t) {
			const e = this.nodeTypesStore.allNodeTypes,
				s = [];
			e.forEach((o) => {
				const n = Array.isArray(o.version) ? o.version : [o.version];
				!!t.find((i) => i.name === o.name && n.includes(i.version)) &&
					!o.hasOwnProperty('properties') &&
					s.push({
						name: o.name,
						version: Array.isArray(o.version) ? o.version.slice(-1)[0] : o.version,
					});
			}),

Please share the workflow

It’s not possible to create a workflow. The error is now thrown on any node I try to drag to the dashboard

Share the output returned by the last node

–

Information on your n8n setup

  • n8n version: 0.211.1
  • Database you’re using (default: SQLite): SQLite
  • Running n8n with the execution process [own(default), main]: own
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: npm

Hi @cauterize, welcome to the community forum!

Perhaps our chief node builder @marcus can take a look into this one?

Great avatar btw, hope you enjoyed the remastered DOTT as much as I did :smiley:

Hi @cauterize,
I had a quick look at your code and couldn’t identify a problem per se, but I would need to invest more time to figure out whats wrong.

Do you need to implement node versioning for your first PoC or would you be able to continue without it?

We already started development without versioning. So we are fine for now.

But at some point we will be forced to integrate breaking changes and therefore we need versioning.

I’m also kind of scared by the fact that one wrongly configured custom node can bring the whole low code platform to a standstill…

Would be nice to understand the underlying problem…

1 Like

I understand that this wasn’t the best first experience in regards to node versioning. I will take a look at this once I have more time but usually we were able to introduce new node versions without any such problems.

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