File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,8 @@ import {
27
27
import {
28
28
CognitoIdentityProviderClient ,
29
29
DeleteUserPoolCommand ,
30
+ DeleteUserPoolDomainCommand ,
31
+ DescribeUserPoolCommand ,
30
32
ListUserPoolsCommand ,
31
33
ListUserPoolsCommandOutput ,
32
34
UserPoolDescriptionType ,
@@ -296,6 +298,19 @@ const staleUserPools = await listStaleCognitoUserPools();
296
298
for ( const staleUserPool of staleUserPools ) {
297
299
if ( staleUserPool . Name ) {
298
300
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
+ }
299
314
await cognitoClient . send (
300
315
new DeleteUserPoolCommand ( {
301
316
UserPoolId : staleUserPool . Id ,
You can’t perform that action at this time.
0 commit comments