From de7c4dbed10ad06b1028a34d27929318f537c85d Mon Sep 17 00:00:00 2001 From: Omar Ajoue Date: Wed, 29 Jun 2022 16:27:55 +0200 Subject: [PATCH] Fix credential usage and error output --- credentials/HttpBinApi.credentials.ts | 7 ++----- nodes/ExampleNode/ExampleNode.node.ts | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/credentials/HttpBinApi.credentials.ts b/credentials/HttpBinApi.credentials.ts index 62f170b..805b83d 100644 --- a/credentials/HttpBinApi.credentials.ts +++ b/credentials/HttpBinApi.credentials.ts @@ -1,9 +1,7 @@ import { IAuthenticateGeneric, - ICredentialDataDecryptedObject, ICredentialTestRequest, ICredentialType, - IHttpRequestOptions, INodeProperties, } from 'n8n-workflow'; @@ -33,9 +31,8 @@ export class HttpBinApi implements ICredentialType { authenticate = { type: 'generic', properties: { - header: { - name: 'api-key', - value: '={{$credentials.apiKey}}', + headers: { + Authorization: '={{"Bearer " + $credentials.token}}', }, }, } as IAuthenticateGeneric; diff --git a/nodes/ExampleNode/ExampleNode.node.ts b/nodes/ExampleNode/ExampleNode.node.ts index d7e111f..29fbcfc 100644 --- a/nodes/ExampleNode/ExampleNode.node.ts +++ b/nodes/ExampleNode/ExampleNode.node.ts @@ -61,7 +61,7 @@ export class ExampleNode implements INodeType { error.context.itemIndex = itemIndex; throw error; } - throw new NodeOperationError(this.getNode(), error.message, { + throw new NodeOperationError(this.getNode(), error, { itemIndex, }); }