I submitted a node and the automatic tests are failing with this error message
Missing credential test - Please see our Node Starter Kit for reference: https://github.com/n8n-io/n8n-nodes-starter/blob/master/credentials/ExampleCredentialsApi.credentials.ts#L52
But that URL sends to a 404 page and as that file doesn’t exist so not really sure what am I supposed to do here. Tried a couple of fixes I found in the community but nothing worked.
Hey! That GitHub link is outdated - the n8n team moved their docs around. The error is telling you that your custom node needs a credential test function.
Here’s what you need to add to your credential file:
export class YourApiCredentials implements ICredentialType {
name = 'yourApi';
displayName = 'Your API';
properties: INodeProperties[] = [
{
displayName: 'API Key',
name: 'apiKey',
type: 'string',
typeOptions: { password: true },
default: '',
},
];
// This is what's missing - add the test function:
async authenticate(
credentials: ICredentialDataDecryptedObject,
): Promise<INodeCredentialTestResult> {
const options = {
method: 'GET',
url: 'https://your-api.com/test-endpoint', // Use any endpoint that verifies the API key
headers: {
'Authorization': `Bearer ${credentials.apiKey}`,
},
};
try {
await this.helpers.request(options);
return {
status: 'OK',
message: 'Authentication successful!',
};
} catch (error) {
return {
status: 'Error',
message: error.message,
};
}
}
}
What this does: When someone adds your credentials in n8n, it’ll automatically test if the API key works by calling your API.
Updated docs are here: https://docs.n8n.io/integrations/creating-nodes/build/credentials/#testing-credentials
Once you add this and push again, the automated tests should pass. I’ve built a few custom n8n nodes for clients and this credential test is required for all community nodes.
Let me know if you need help with the specific API endpoint to use for testing!
Nope, nada. So looks like I need help…how can we do this? 
@hoiyothaheem would love your help here, still can’t get this to work…
Hey! Let me break this down step by step for you.
The credential test needs to go in your credentials file (not in the node file). Here’s exactly what to do:
-
Find your credentials file - it should be something like YourServiceApi.credentials.ts
-
Add this test method inside your credentials class:
test: ICredentialTestRequest = {
request: {
method: 'GET',
url: 'https://your-api.com/test-endpoint', // Use any endpoint that validates the key
headers: {
'Authorization': '={{"Bearer " + $credentials.apiKey}}', // Adjust based on your auth
},
},
};
-
Make sure the URL points to a real endpoint from your API that returns 200 when the credentials are valid
-
The $credentials.apiKey should match whatever property name you used in your credential fields
Example - if your API uses a simple API key in the header:
test: ICredentialTestRequest = {
request: {
method: 'GET',
url: 'https://api.yourservice.com/v1/user',
headers: {
'X-API-Key': '={{$credentials.apiKey}}',
},
},
};
What API are you building the node for? I can give you the exact test endpoint to use.
Hey, appreciate the reply! We’re creating our own node (adyntel). Are you saying that those credentials need to automatically return a 200? Because I’ve tried with the real endpoint (api.adyntel.com/facebook for example) and still didn’t work.
You can find our file here - adyntel-n8n-node/credentials/AdyntelApi.credentials.ts at main · Adyntel/adyntel-n8n-node · GitHub
I tried with this in 20 different ways and it always fails…