File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import { Logger } from './logger.js';
99import * as yaml from 'yaml' ;
1010
1111let cloudFormationClient : CloudFormationClient ;
12+ const originalConsoleError = console . error ;
1213
1314/**
1415 * Get CloudFormation stack template
@@ -84,13 +85,16 @@ async function getCloudFormationResources(
8485 stackName : string ,
8586 awsConfiguration : AwsConfiguration ,
8687) {
88+ let ListStackResourcesCommand : typeof ListStackResourcesCommandType ;
8789 // temporary disable console.error because SAM framework outputs useless errors
88- const originalConsoleError = console . error ;
89- console . error = function ( ) { } ;
90- const { ListStackResourcesCommand } = await import (
91- '@aws-sdk/client-cloudformation'
92- ) ;
93- console . error = originalConsoleError ;
90+ try {
91+ console . error = function ( ) { } ;
92+
93+ const clientCloudFormation = await import ( '@aws-sdk/client-cloudformation' ) ;
94+ ListStackResourcesCommand = clientCloudFormation . ListStackResourcesCommand ;
95+ } finally {
96+ console . error = originalConsoleError ;
97+ }
9498
9599 const cloudFormationClient : CloudFormationClient =
96100 await getCloudFormationClient ( awsConfiguration ) ;
You can’t perform that action at this time.
0 commit comments