Skip to content

Commit e3e7ad1

Browse files
fix: Handling missing stack
1 parent b540a93 commit e3e7ad1

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

src/frameworks/cdkFramework.ts

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -183,19 +183,22 @@ export class CdkFramework implements IFramework {
183183
awsConfiguration,
184184
);
185185
// get all Lambda functions in the template
186-
const lambdas = Object.entries(cfTemplate.Resources)
187-
.filter(
188-
([, resource]: [string, any]) =>
189-
resource.Type === 'AWS::Lambda::Function',
190-
)
191-
.map(([key, resource]: [string, any]) => {
192-
return {
193-
logicalId: key,
194-
cdkPath: resource.Metadata['aws:cdk:path'],
195-
};
196-
});
186+
if (cfTemplate) {
187+
const lambdas = Object.entries(cfTemplate.Resources)
188+
.filter(
189+
([, resource]: [string, any]) =>
190+
resource.Type === 'AWS::Lambda::Function',
191+
)
192+
.map(([key, resource]: [string, any]) => {
193+
return {
194+
logicalId: key,
195+
cdkPath: resource.Metadata['aws:cdk:path'],
196+
};
197+
});
198+
return lambdas;
199+
}
197200

198-
return lambdas;
201+
return [];
199202
}
200203

201204
/**

0 commit comments

Comments
 (0)