Skip to content

Commit e5d1da0

Browse files
author
Megha Narayanan
committed
handle undefined response on describestacks command
1 parent 1c6d9c0 commit e5d1da0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/cli/src/commands/sandbox/sandbox-devtools/sandbox_devtools_command.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,14 @@ export class SandboxDevToolsCommand implements CommandModule<object> {
367367
try {
368368
const cfnClient = this.awsClientProvider.getCloudFormationClient();
369369
const stackName = BackendIdentifierConversions.toStackName(backendId);
370-
await cfnClient.send(
370+
const response = await cfnClient.send(
371371
new DescribeStacksCommand({ StackName: stackName }),
372372
);
373+
374+
if (!response || !response.Stacks || response.Stacks.length === 0) {
375+
return 'nonexistent';
376+
}
377+
373378
return 'stopped'; // Stack exists, default to stopped
374379
} catch (error) {
375380
if (String(error).includes('does not exist')) {

0 commit comments

Comments
 (0)