From 5805e3f8dd05f4d7985e826f1c7f6a7712c26224 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dennis=20Tr=C3=BCmper?= Date: Fri, 21 Jan 2022 10:20:38 +0100 Subject: [PATCH] fix: crash without stackTags --- lib/index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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) }