From d3f0b5243cf8d939cafb685cabf187ed0a685c09 Mon Sep 17 00:00:00 2001 From: lschulzes Date: Sat, 25 May 2024 15:47:48 -0300 Subject: [PATCH] fix: metada access of undefined --- serverless-plugin/serverless-plugin.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/serverless-plugin/serverless-plugin.ts b/serverless-plugin/serverless-plugin.ts index e415efad..cc5ea4fc 100644 --- a/serverless-plugin/serverless-plugin.ts +++ b/serverless-plugin/serverless-plugin.ts @@ -71,9 +71,11 @@ class ServerlessPlugin { const funcConfig = func.slicWatch ?? {} const functionLogicalId = awsProvider.naming.getLambdaLogicalId(funcName) const templateResources = compiledTemplate.Resources as Record - templateResources[functionLogicalId].Metadata = { - ...templateResources[functionLogicalId].Metadata ?? {}, - slicWatch: funcConfig + if (typeof templateResources[functionLogicalId] !== 'undefined') { + templateResources[functionLogicalId].Metadata = { + ...templateResources[functionLogicalId].Metadata ?? {}, + slicWatch: funcConfig + } } }