From 81ca11cb599e0e27a344790507aab4bc57730b17 Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Mon, 23 Dec 2019 07:29:28 -0600 Subject: [PATCH] :zap: Improve error message on GithubTrigger #162 --- packages/nodes-base/nodes/Github/GithubTrigger.node.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/Github/GithubTrigger.node.ts b/packages/nodes-base/nodes/Github/GithubTrigger.node.ts index 54d3de8f9..2a14b5d3d 100644 --- a/packages/nodes-base/nodes/Github/GithubTrigger.node.ts +++ b/packages/nodes-base/nodes/Github/GithubTrigger.node.ts @@ -332,7 +332,11 @@ export class GithubTrigger implements INodeType { return true; }, async create(this: IHookFunctions): Promise { - const webhookUrl = this.getNodeWebhookUrl('default'); + const webhookUrl = this.getNodeWebhookUrl('default') as string; + + if (webhookUrl.includes('//localhost')) { + throw new Error('The Webhook can not work on "localhost". Please, either setup n8n on a custom domain or start with "--tunnel"!'); + } const owner = this.getNodeParameter('owner') as string; const repository = this.getNodeParameter('repository') as string; @@ -377,7 +381,7 @@ export class GithubTrigger implements INodeType { } } - throw new Error('A webhook with the identical URL exists already. Please delete it manually on Github!'); + throw new Error('A webhook with the identical URL probably exists already. Please delete it manually on Github!'); } throw e;