Skip to content

Commit 9fee057

Browse files
author
Kamil Sobol
authored
delete domain (#2336)
1 parent d478559 commit 9fee057

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

scripts/cleanup_e2e_resources.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ import {
2727
import {
2828
CognitoIdentityProviderClient,
2929
DeleteUserPoolCommand,
30+
DeleteUserPoolDomainCommand,
31+
DescribeUserPoolCommand,
3032
ListUserPoolsCommand,
3133
ListUserPoolsCommandOutput,
3234
UserPoolDescriptionType,
@@ -296,6 +298,19 @@ const staleUserPools = await listStaleCognitoUserPools();
296298
for (const staleUserPool of staleUserPools) {
297299
if (staleUserPool.Name) {
298300
try {
301+
const describeUserPoolResponse = await cognitoClient.send(
302+
new DescribeUserPoolCommand({
303+
UserPoolId: staleUserPool.Id,
304+
})
305+
);
306+
if (describeUserPoolResponse.UserPool?.Domain) {
307+
await cognitoClient.send(
308+
new DeleteUserPoolDomainCommand({
309+
UserPoolId: describeUserPoolResponse.UserPool.Id,
310+
Domain: describeUserPoolResponse.UserPool?.Domain,
311+
})
312+
);
313+
}
299314
await cognitoClient.send(
300315
new DeleteUserPoolCommand({
301316
UserPoolId: staleUserPool.Id,

0 commit comments

Comments
 (0)