diff --git a/lib/plugins/aws/deploy/compile/events/alexaSkill/index.js b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.js index e15818d8c..5519ccd53 100644 --- a/lib/plugins/aws/deploy/compile/events/alexaSkill/index.js +++ b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.js @@ -17,6 +17,7 @@ class AwsCompileAlexaSkillEvents { const functionObj = this.serverless.service.getFunction(functionName); if (functionObj.events) { + console.log(functionObj.events); functionObj.events.forEach(event => { if (event === 'alexaSkill') { const lambdaLogicalId = this.provider.naming @@ -45,7 +46,7 @@ class AwsCompileAlexaSkillEvents { _.merge(this.serverless.service.provider.compiledCloudFormationTemplate.Resources, permissionCloudForamtionResource); - } else { + } else if (event.alexaSkill) { const errorMessage = [ `Alexa Skill event of function "${functionName}" is not an object or string.`, ' The correct syntax is: alexaSkill.', diff --git a/lib/plugins/aws/deploy/compile/events/alexaSkill/index.test.js b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.test.js index 74d5ad44d..bec6d87ea 100644 --- a/lib/plugins/aws/deploy/compile/events/alexaSkill/index.test.js +++ b/lib/plugins/aws/deploy/compile/events/alexaSkill/index.test.js @@ -25,7 +25,7 @@ describe('AwsCompileAlexaSkillEvents', () => { }); describe('#compileAlexaSkillEvents()', () => { - it('should throw an error if alexaSkill event type is not an object', () => { + it('should throw an error if alexaSkill event is not an string', () => { awsCompileAlexaSkillEvents.serverless.service.functions = { first: { events: [ @@ -39,15 +39,11 @@ describe('AwsCompileAlexaSkillEvents', () => { expect(() => awsCompileAlexaSkillEvents.compileAlexaSkillEvents()).to.throw(Error); }); - it('should create corresponding resources when event is given and enabled', () => { + it('should create corresponding resources when a alexaSkill event is provided', () => { awsCompileAlexaSkillEvents.serverless.service.functions = { first: { events: [ - { - alexaSkill: { - enabled: true, - }, - }, + 'alexaSkill', ], }, }; @@ -72,27 +68,6 @@ describe('AwsCompileAlexaSkillEvents', () => { ).to.equal('alexa-appkit.amazon.com'); }); - it('should not create corresponding resources when event is given but not enabled', () => { - awsCompileAlexaSkillEvents.serverless.service.functions = { - first: { - events: [ - { - alexaSkill: { - enabled: false, - }, - }, - ], - }, - }; - - awsCompileAlexaSkillEvents.compileAlexaSkillEvents(); - - expect( - awsCompileAlexaSkillEvents.serverless.service.provider - .compiledCloudFormationTemplate.Resources - ).to.deep.equal({}); - }); - it('should not create corresponding resources when alexaSkill event is not given', () => { awsCompileAlexaSkillEvents.serverless.service.functions = { first: {