Custom n8n node credential testing error - test function not being recognized

I’m working on creating a custom n8n node for Oracle database connections and running into an issue with credential testing.

I’ve set up my credentials to use a separate test function in my node file instead of putting the authentication logic directly in the credentials file. However, n8n keeps throwing an error saying it can’t find the test function for my credentials.

Here’s how I configured the credentials in my node file:

credentials: [
    {
        name: 'oracleConnection',
        required: true,
        testedBy: 'validateConnection'
    }
],

And I’ve defined the test function in my methods object:

methods = {
    listSearch: {
        searchDatabases
    },
    // credential validation function defined here:
    credentialTest: {
        validateConnection /** imported from external file */
    }
};

My validation function implements the proper ICredentialsTestFunction interface:
export declare type ICredentialTestFunction = (this: ICredentialTestFunctions, credential: ICredentialsDecrypted) => Promise<INodeCredentialTestResult>;

I looked at how PostgreSQL and other database nodes handle this and my implementation seems identical to theirs, but the test function still isn’t being detected.

Any ideas what could be causing this?

Had the same problem with custom nodes. It’s usually the function export structure. Export your validateConnection function as a named export, not default. Also double-check your credentialTest object formatting - n8n’s picky about that stuff. Make sure the property name in your methods object is right too. Try clearing n8n’s cache and restarting the dev server - sometimes the function registration gets stuck.

if ur still havin the error, its likely a scope issue. check that validateConnection is accessible where ur using it. also, double-check the import path for typos - they can be easy to miss!

This might be due to your function declaration syntax. I encountered the same issue while building a custom Salesforce node last year. I was using arrow functions in the credentialTest object instead of standard function declarations. N8n’s credential testing is particular about how functions are defined and bound. Consider declaring validateConnection as a regular function instead of importing it directly. If importing is necessary, ensure it’s correctly bound to the context. Additionally, check that your node’s class structure aligns with n8n’s expectations; sometimes the methods object requires a different setup, especially when extending INodeType or using the newer class-based approach. The error message often lacks clarity about what exactly it cannot locate.