lambda-live-debugger 0.0.121 → 0.0.123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cloudFormation.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AwsCredentials } from './awsCredentials.mjs';
|
|
2
|
+
import { Logger } from './logger.mjs';
|
|
2
3
|
let cloudFormationClient;
|
|
3
4
|
/**
|
|
4
5
|
* Get CloudFormation stack template
|
|
@@ -20,7 +21,8 @@ async function getCloudFormationStackTemplate(stackName, awsConfiguration) {
|
|
|
20
21
|
}
|
|
21
22
|
catch (error) {
|
|
22
23
|
if (error.name === 'ValidationError') {
|
|
23
|
-
|
|
24
|
+
Logger.error(`Stack ${stackName} not found. Try specifying a region. Error: ${error.message}`, error);
|
|
25
|
+
return undefined;
|
|
24
26
|
}
|
|
25
27
|
else {
|
|
26
28
|
throw error;
|
|
@@ -60,7 +62,8 @@ async function getCloudFormationResources(stackName, awsConfiguration) {
|
|
|
60
62
|
}
|
|
61
63
|
catch (error) {
|
|
62
64
|
if (error.name === 'ValidationError') {
|
|
63
|
-
|
|
65
|
+
Logger.error(`Stack ${stackName} not found. Try specifying a region. Error: ${error.message}`, error);
|
|
66
|
+
return undefined;
|
|
64
67
|
}
|
|
65
68
|
else {
|
|
66
69
|
throw error;
|
|
@@ -75,7 +78,7 @@ async function getCloudFormationResources(stackName, awsConfiguration) {
|
|
|
75
78
|
*/
|
|
76
79
|
async function getLambdasInStack(stackName, awsConfiguration) {
|
|
77
80
|
const response = await getCloudFormationResources(stackName, awsConfiguration);
|
|
78
|
-
const lambdaResources = response
|
|
81
|
+
const lambdaResources = response?.StackResourceSummaries?.filter((resource) => resource.ResourceType === 'AWS::Lambda::Function');
|
|
79
82
|
return (lambdaResources?.map((resource) => {
|
|
80
83
|
return {
|
|
81
84
|
lambdaName: resource.PhysicalResourceId,
|
|
Binary file
|
|
@@ -121,15 +121,18 @@ export class CdkFramework {
|
|
|
121
121
|
async getLambdaCdkPathFromTemplateMetadata(stackName, awsConfiguration) {
|
|
122
122
|
const cfTemplate = await CloudFormation.getCloudFormationStackTemplate(stackName, awsConfiguration);
|
|
123
123
|
// get all Lambda functions in the template
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
124
|
+
if (cfTemplate) {
|
|
125
|
+
const lambdas = Object.entries(cfTemplate.Resources)
|
|
126
|
+
.filter(([, resource]) => resource.Type === 'AWS::Lambda::Function')
|
|
127
|
+
.map(([key, resource]) => {
|
|
128
|
+
return {
|
|
129
|
+
logicalId: key,
|
|
130
|
+
cdkPath: resource.Metadata['aws:cdk:path'],
|
|
131
|
+
};
|
|
132
|
+
});
|
|
133
|
+
return lambdas;
|
|
134
|
+
}
|
|
135
|
+
return [];
|
|
133
136
|
}
|
|
134
137
|
/**
|
|
135
138
|
* Get Lambdas data from CDK by compiling and running the CDK code
|