-
Notifications
You must be signed in to change notification settings - Fork 4.5k
(cli): describeStackEvents queries ALL stack events when looking for new events #32186
Description
Describe the bug
After upgrading to 2.167.0, our deployments using GitHub Actions went from taking 10-11 minutes, to taking ~1 hour.
In reality, the deployments are taking roughly the same time, but the GitHub Actions runner is not receiving the answer.
I believe this is due to a change where all the stack events are loaded at once, before looping through them from newest to oldest and stopping when an event is met that has already been handled.
It should be said that I queried all stack events for one of our stacks and it has ~400,000 events.
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Version
2.166.0
Expected Behavior
CLI getting feedback about stack deployment quickly.
Current Behavior
CLI not getting feedback about stack deployment until a long time after stack deployment has actually finished.
Reproduction Steps
The error only occurs when you have a stack with a large amount of stack events. I do not know how to reproduce that in a test.
The issue occurs for us when using cdk deploywith a stack that has ~400,000 stack events.
Possible Solution
| const eventList = await this.cfn.describeStackEvents({ |
This method is calling
describeStackEvents, and iterating through them, stopping when it reaches one that has already been handled, or one that is older than the poller itself.
| describeStackEvents: async (input: DescribeStackEventsCommandInput): Promise<StackEvent[]> => { |
The method
describeStackEvents is iterating through all pages of the stack events, before returning all of them.
My suggestion is that the poller itself should be iterating through the pages of the stack events, similar to how it was in 2.166.0. Alternatively, the describeStackEvents should return an async iterable or something similar, but my TypeScript is not strong enough to know if that is possible :-)
Additional Information/Context
No response
CDK CLI Version
2.167.1 (build d681b12)
Framework Version
No response
Node.js Version
v22.9.0
OS
macOS 14.6
Language
Python
Language Version
Python 3.10
Other information
No response