Issues with the INodeTypeDescription inputs and outputs properties

Hello, I have implemented a custom node in n8n and everything was fine. Today I updated the n8n-workflow package to v1.82.0. Since then I can’t build my custom node because the way I define the inputs/outputs property of the INodeTypeDescription.

Previously I defined it as follows:
inputs: [‘main’]
outputs: [‘main’]

and now like this:
inputs: [NodeConnectionType.Main]
outputs: [NodeConnectionType.Main]

My problem now is that none of both ways are working anymore and I can’t find a different approach.

I get the following message when I use inputs: [NodeConnectionType.Main]

and this one using inputs: [‘main’]

Does anybody know what to do here?

Thanks in advance!

Do you mind sharing the portion of the code that presents the error?

I just made this simple Hello World Node running because I had troubles making the node available in my docker environment.

import { INodeType, INodeTypeDescription, IExecuteFunctions, NodeConnectionType } from 'n8n-workflow';

export class HelloWorld implements INodeType {
    description: INodeTypeDescription = {
        displayName: 'Hello World',
        name: 'helloWorld',
        group: ['transform'],
        version: 1,
        description: 'Returns the string HelloWorld',
        defaults: {
            name: 'Hello World',
        },
        inputs: ['main'],
        outputs: ['main'],
        properties: [],
    };

    async execute(this: IExecuteFunctions) {
        return [
            [{ json: { message: 'HelloWorld' } }]
        ];
    }
}

After I made it work I realized the n8n-workflow package I used was outdated (some version around 1.42) and I updated to v1.82. With this update the linter didn’t liked using [‘main’] for inputs and outputs.

The solution was to also update eslint which seems to be obvious but I totally missed that possibility. Now it works with the NodeConnectionType Enum as expected.

3 Likes

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