n8n node development: "No testing function found for this credential."

166 views Asked by At

I'm busy building my own node that connects to Oracle, and stumbled upon this problem...

I have a credentials file that does not contain any authentication or testing methods, as I am declaring a separate testing function in the node.ts file. When testing my node, it keeps saying that my credentials don't have a corresponding test function.

In my node.ts file I am stating that my credentials be tested by a function called testConnection:

credentials: [
            {
                name: 'myConnection',
                required: true,
                testedBy: 'testConnection'
            }
        ],

which is declared in my node's methods object like so:

methods = {
        listSearch: {
            searchTables
        },
                //the credential test function is declared here:
        credentialTest: {
            testConnection /** this function is imported from another file */
        }
    };

My test function follows the ICredentialsTestFunction interface signature that looks like this: export declare type ICredentialTestFunction = (this: ICredentialTestFunctions, credential: ICredentialsDecrypted) => Promise<INodeCredentialTestResult>;

I've checked how MySQL and other similar nodes are doing it and I expected my code to work correctly as theirs do, yet it does not recognize the test function.

What am I doing wrong?

1

There are 1 answers

0
Heavy On

There is a bug in n8n. credentialTest doesn't work with custom nodes properly.

See this Github issue: https://github.com/n8n-io/n8n/issues/8188