From dfa0967ecf693e8fdc191ac1c9f6bc3d1e4ae366 Mon Sep 17 00:00:00 2001 From: Mariusz Nowak Date: Mon, 23 Dec 2019 12:15:20 +0100 Subject: [PATCH] fix(AWS APIGW): Ensure to apply API GW stage settings with no endpoints Fixes #7036 --- lib/plugins/aws/package/compile/events/apiGateway/index.js | 4 ---- .../aws/package/compile/events/apiGateway/index.test.js | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/plugins/aws/package/compile/events/apiGateway/index.js b/lib/plugins/aws/package/compile/events/apiGateway/index.js index b89ca8d96..ac9042869 100644 --- a/lib/plugins/aws/package/compile/events/apiGateway/index.js +++ b/lib/plugins/aws/package/compile/events/apiGateway/index.js @@ -75,10 +75,6 @@ class AwsCompileApigEvents { const getServiceState = require('../../../../lib/getServiceState').getServiceState; const state = getServiceState.call(this); - if (!this.serverless.utils.isEventUsed(state.service.functions, 'http')) { - return BbPromise.resolve(); - } - const updateStage = require('./lib/hack/updateStage').updateStage; this.state = state; diff --git a/lib/plugins/aws/package/compile/events/apiGateway/index.test.js b/lib/plugins/aws/package/compile/events/apiGateway/index.test.js index ca4042838..3009f8de1 100644 --- a/lib/plugins/aws/package/compile/events/apiGateway/index.test.js +++ b/lib/plugins/aws/package/compile/events/apiGateway/index.test.js @@ -142,7 +142,7 @@ describe('AwsCompileApigEvents', () => { }); }); - it('should skip the updateStage step when no http events are found', () => { + it('should not skip the updateStage step when no http events are found', () => { getServiceStateStub.returns({ service: { functions: { @@ -154,7 +154,7 @@ describe('AwsCompileApigEvents', () => { }); return awsCompileApigEvents.hooks['after:deploy:deploy']().then(() => { - expect(updateStageStub.calledOnce).to.equal(false); + expect(updateStageStub.calledOnce).to.equal(true); }); }); });