From a7c82f40f5f8e841ad5eaab53f43624a78254752 Mon Sep 17 00:00:00 2001 From: Shane DeWael Date: Tue, 1 Oct 2019 14:55:59 -0700 Subject: [PATCH 1/2] Fixes #235 --- src/App.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/App.ts b/src/App.ts index 1669d6c9e..4d8f11b99 100644 --- a/src/App.ts +++ b/src/App.ts @@ -160,7 +160,7 @@ export default class App { this.listeners = []; // Check for required arguments of ExpressReceiver - if (signingSecret !== undefined) { + if (signingSecret !== undefined && receiver === undefined) { this.receiver = new ExpressReceiver({ signingSecret, logger, endpoints }); } else if (receiver === undefined) { // Check for custom receiver From 19fd9d663977504ac7b8a8cf1716689631aa47e3 Mon Sep 17 00:00:00 2001 From: Shane DeWael Date: Thu, 3 Oct 2019 10:06:10 -0700 Subject: [PATCH 2/2] Kaz edits --- src/App.ts | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/App.ts b/src/App.ts index 4d8f11b99..ddde5fbc6 100644 --- a/src/App.ts +++ b/src/App.ts @@ -160,17 +160,20 @@ export default class App { this.listeners = []; // Check for required arguments of ExpressReceiver - if (signingSecret !== undefined && receiver === undefined) { - this.receiver = new ExpressReceiver({ signingSecret, logger, endpoints }); - } else if (receiver === undefined) { - // Check for custom receiver - throw errorWithCode( - 'Signing secret not found, so could not initialize the default receiver. Set a signing secret or use a ' + - 'custom receiver.', - ErrorCode.AppInitializationError, - ); - } else { + if (receiver !== undefined) { this.receiver = receiver; + } else { + // No custom receiver + if (signingSecret === undefined) { + throw errorWithCode( + 'Signing secret not found, so could not initialize the default receiver. Set a signing secret or use a ' + + 'custom receiver.', + ErrorCode.AppInitializationError, + ); + } else { + // Create default ExpressReceiver + this.receiver = new ExpressReceiver({ signingSecret, logger, endpoints }); + } } // Subscribe to messages and errors from the receiver