Skip to content

Commit 5e48ac1

Browse files
fix: Search for all functions in the stack
1 parent 6d3bd07 commit 5e48ac1

File tree

2 files changed

+43
-26
lines changed

2 files changed

+43
-26
lines changed

public/site.webmanifest

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
{
2-
"name": "",
3-
"short_name": "",
4-
"icons": [
5-
{
6-
"src": "/android-chrome-192x192_light.png",
7-
"sizes": "192x192",
8-
"type": "image/png"
9-
},
10-
{
11-
"src": "/android-chrome-512x512_light.png",
12-
"sizes": "512x512",
13-
"type": "image/png"
14-
}
15-
],
16-
"theme_color": "#ffffff",
17-
"background_color": "#ffffff",
18-
"display": "standalone"
19-
}
2+
"name": "",
3+
"short_name": "",
4+
"icons": [
5+
{
6+
"src": "/android-chrome-192x192_light.png",
7+
"sizes": "192x192",
8+
"type": "image/png"
9+
},
10+
{
11+
"src": "/android-chrome-512x512_light.png",
12+
"sizes": "512x512",
13+
"type": "image/png"
14+
}
15+
],
16+
"theme_color": "#ffffff",
17+
"background_color": "#ffffff",
18+
"display": "standalone"
19+
}

src/cloudFormation.ts

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import type { CloudFormationClient } from '@aws-sdk/client-cloudformation';
1+
import {
2+
type ListStackResourcesCommand as ListStackResourcesCommandType,
3+
type StackResourceSummary,
4+
type CloudFormationClient,
5+
} from '@aws-sdk/client-cloudformation';
26
import { AwsCredentials } from './awsCredentials.js';
37
import { AwsConfiguration } from './types/awsConfiguration.js';
48
import { Logger } from './logger.js';
@@ -72,15 +76,28 @@ async function getCloudFormationResources(
7276
const { ListStackResourcesCommand } = await import(
7377
'@aws-sdk/client-cloudformation'
7478
);
75-
const command = new ListStackResourcesCommand({
76-
StackName: stackName,
77-
});
78-
const cloudFormationClient = await getCloudFormationClient(awsConfiguration);
79+
80+
const cloudFormationClient: CloudFormationClient =
81+
await getCloudFormationClient(awsConfiguration);
7982

8083
try {
81-
const response = await cloudFormationClient.send(command);
84+
let nextToken: string | undefined = undefined;
85+
const items: StackResourceSummary[] = [];
86+
do {
87+
const command: ListStackResourcesCommandType =
88+
new ListStackResourcesCommand({
89+
StackName: stackName,
90+
NextToken: nextToken,
91+
});
92+
93+
const response = await cloudFormationClient.send(command);
8294

83-
return response;
95+
if (response.StackResourceSummaries) {
96+
items.push(...response.StackResourceSummaries);
97+
}
98+
nextToken = response.NextToken;
99+
} while (nextToken);
100+
return items;
84101
} catch (error: any) {
85102
if (error.name === 'ValidationError') {
86103
Logger.error(
@@ -113,7 +130,7 @@ async function getLambdasInStack(
113130
stackName,
114131
awsConfiguration,
115132
);
116-
const lambdaResources = response?.StackResourceSummaries?.filter(
133+
const lambdaResources = response?.filter(
117134
(resource) => resource.ResourceType === 'AWS::Lambda::Function',
118135
);
119136

0 commit comments

Comments
 (0)