Custom Node continueOnFail

Hi - Is it possible for custom nodes to access the continueOnFail function defined in IExecuteFunctions?

When I execute n8n-node-dev build using the source code below I get the following error: “DummyNode.node.ts(35,20): error TS2339: Property ‘continueOnFail’ does not exist on type ‘IExecuteFunctions’.”

I see that interface IExecuteFunctions (the workflow one) has the continueOnFail fail. I don’t get the same error for the function getInputData, which is also used in the code below. Is this error limitation of the code generated with n8n-node-dev build?

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


export class DummyNode implements INodeType {
	description: INodeTypeDescription = {
		displayName: 'Dummy Node',
		name: 'dummyNode',
		group: ['transform'],
		version: 1,
		description: 'Converts dummy data into more dummy data',
		defaults: {
			name: 'Dummy Node',
			color: '#772244',
		},
		inputs: ['main'],
		outputs: ['main'],
		properties: [],
	};


	async execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {

		const items = this.getInputData();

		for (let itemIndex = 0; itemIndex < items.length; itemIndex++) {
			const item = items[itemIndex];

			if (item.json.field === "some random value") {
				item.json.binary = true;
			} else if (this.continueOnFail()) {
				item.json.failed = true;
			}
		}

		return this.prepareOutputData(items);

	}
}

I guess the issue is that an old version of the n8n-workflow module gets used which did not contain that property yet. It should actually pick the latest version automatically as the version got defined in the package.json with ^ but maybe it does not for some reason.

So to be “sure” I just released a new version of n8n-node-dev (0.7.0) which has specifically the latest versions set.

So try to upgrade n8n-node-dev to that version and then try again (check if it really installed [email protected]. I hope it fixes this problem for you!

1 Like

Thanks so much for your quick response, @jan. Updating n8n-node-dev to version 0.7.0 solved the problem. I had forgotten it was a globally installed package.