From 60cfa75d6b5ce5b41b70739612d1f128abf05316 Mon Sep 17 00:00:00 2001 From: David Wells Date: Wed, 7 Oct 2020 01:53:12 -0700 Subject: [PATCH] fix(AWS IAM): Report missing `RoleName` on custom role (#8219) --- lib/plugins/aws/deployFunction/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/plugins/aws/deployFunction/index.js b/lib/plugins/aws/deployFunction/index.js index e7449fcdd86..46d7e1d35d2 100644 --- a/lib/plugins/aws/deployFunction/index.js +++ b/lib/plugins/aws/deployFunction/index.js @@ -77,8 +77,10 @@ class AwsDeployFunction { if (roleResource.Type !== 'AWS::IAM::Role') { throw new Error('Provided resource is not IAM Role.'); } - const roleProperties = roleResource.Properties; + if (!roleProperties.RoleName) { + throw new this.serverless.classes.Error('Role resource missing RoleName property'); + } const compiledFullRoleName = `${roleProperties.Path || '/'}${roleProperties.RoleName}`; return this.provider