tmont/tail-stack-events

script fails when stack is deleted

Closed this issue · 2 comments

When running the script to monitor a stack that is being deleted, the script errors out at the end (when the stack is finally deleted):

$ tail-stack-events -s test --region us-west-2 --die
Aug 29 15:06:09 Instance EC2::Instance ⌛ CREATE_IN_PROGRESS Resource creation Initiated
Aug 29 15:06:25 Instance EC2::Instance ✓ CREATE_COMPLETE
Aug 29 15:06:27 test CloudFormation::Stack ✓ CREATE_COMPLETE
Aug 29 15:07:52 test CloudFormation::Stack ⌛ DELETE_IN_PROGRESS User Initiated
Aug 29 15:07:53 Instance EC2::Instance ⌛ DELETE_IN_PROGRESS
{ ValidationError: Stack [test] does not exist
at Request.extractError (/usr/local/lib/node_modules/aws-sdk/lib/protocol/query.js:47:29)
at Request.callListeners (/usr/local/lib/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/usr/local/lib/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/usr/local/lib/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/usr/local/lib/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/usr/local/lib/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /usr/local/lib/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request. (/usr/local/lib/node_modules/aws-sdk/lib/request.js:38:9)
at Request. (/usr/local/lib/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/usr/local/lib/node_modules/aws-sdk/lib/sequential_executor.js:115:18)
message: 'Stack [test] does not exist',
code: 'ValidationError',
time: 2018-08-29T20:08:41.968Z,
requestId: '5355bf46-abc7-11e8-97a3-15d6ff895f0e',
statusCode: 400,
retryable: false,
retryDelay: 68.2882874659061 }

Still ocurring with version 2.1.0.

$ npm exec tail-stack-events -- --stack-name ... --follow --die --region eu-central-1
CloudFormationServiceException [ValidationError]: Stack [...] does not exist
    at throwDefaultError (/home/isme/Repos/.../node_modules/@aws-sdk/smithy-client/dist-cjs/default-error-handler.js:8:22)
    at deserializeAws_queryDescribeStackEventsCommandError (/home/isme/Repos/.../node_modules/@aws-sdk/client-cloudformation/dist-cjs/protocols/Aws_query.js:1582:43)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /home/isme/Repos/.../node_modules/@aws-sdk/middleware-serde/dist-cjs/deserializerMiddleware.js:7:24
    at async /home/isme/Repos/.../node_modules/@aws-sdk/middleware-signing/dist-cjs/middleware.js:14:20
    at async /home/isme/Repos/.../node_modules/@aws-sdk/middleware-retry/dist-cjs/retryMiddleware.js:27:46
    at async /home/isme/Repos/.../node_modules/@aws-sdk/middleware-logger/dist-cjs/loggerMiddleware.js:7:26 {
  '$fault': 'client',
  '$metadata': {
    httpStatusCode: 400,
    requestId: '...',
    extendedRequestId: undefined,
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
  Type: 'Sender',
  Code: 'ValidationError'
}
tmont commented

fixed in 2.2.0

Will now print "Stack no longer exists" and exit gracefully.

image