diff --git a/lib/index.js b/lib/index.js index 88945f5..54c933d 100644 --- a/lib/index.js +++ b/lib/index.js @@ -26,7 +26,7 @@ class ServerlessFargateTasks { template['Resources']['FargateTasksCluster'] = { "Type" : "AWS::ECS::Cluster", 'Properties': { - 'Tags': Object.entries(this.serverless.service.provider.stackTags).map(function(t) { return {Key: t[0], Value: t[1]}}), + 'Tags': Object.entries(this.serverless.service.provider.stackTags ?? {}).map(function(t) { return {Key: t[0], Value: t[1]}}), } } @@ -106,7 +106,7 @@ class ServerlessFargateTasks { 'RequiresCompatibilities': ['FARGATE'], 'Memory': options.tasks[identifier]['memory'] || "0.5GB", 'Cpu': options.tasks[identifier]['cpu'] || 256, - 'Tags': Object.entries(this.serverless.service.provider.stackTags).map(function(t) { return {Key: t[0], Value: t[1]}}), + 'Tags': Object.entries(this.serverless.service.provider.stackTags ?? {}).map(function(t) { return {Key: t[0], Value: t[1]}}), }, task_override) } @@ -135,7 +135,7 @@ class ServerlessFargateTasks { 'Subnets': options.vpc['subnets'] || [], }, network_override), }, - 'Tags': Object.entries(this.serverless.service.provider.stackTags).map(function(t) { return {Key: t[0], Value: t[1]}}), + 'Tags': Object.entries(this.serverless.service.provider.stackTags ?? {}).map(function(t) { return {Key: t[0], Value: t[1]}}), 'PropagateTags': 'TASK_DEFINITION' }, service_override) }