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 + } } }