djheru
07/17/2024, 3:57 PMdev. We have been attempting to update to the newest version, but we're getting an error "Stack not found: dev". When running the describe-stacks command with the aws cli, we are able to see the stack, and the tag is present as expected. Sample outputs below:
npx medplum aws describe dev
Stack not found: dev
AWS Region: us-east-1
AWS Account ID: 600000000006
AWS Account ARN: arn:aws:sts::600000000006:assumed-role/AWSReservedSSO_AdministratorAccess_0be77xxxxxxxxxxc/pdamra
AWS User ID: ARXXXXXXXXXXXXXXXXXXX:pdamra
Error: Stack not found: dev
aws cloudformation describe-stacks --stack-name medplum-dev | jq '.Stacks[0].Tags'
[
{
"Key": "medplum:environment",
"Value": "dev"
}
]deeheber
07/22/2024, 11:21 PMListStacksCommand is paginated and stops at 100 results by default without a StackStatusFilter param in the command. https://github.com/medplum/medplum/blob/main/packages/cli/src/aws/utils.ts#L46
In our AWS account, we have a lot of stacks with StackStatus of DELETE_COMPLETE (it's a shared dev AWS account) and are well over that 100. It appears that the stack we're looking for is after this pagination and never gets retuned.
I was curious if it would be possible for y'all to edit your cli code to have a filter that would explicitly exclude 'DELETED_COMPLETE' in the initial set of results (I do see you're filtering it out later but at that point we're at 100 results returned), so others don't run into the same issue we did?
const listResult = await cloudFormationClient.send(
new ListStacksCommand({
StackStatusFilter: [
'CREATE_COMPLETE',
'UPDATE_COMPLETE',
'ROLLBACK_COMPLETE',
'ROLLBACK_FAILED',
'UPDATE_ROLLBACK_COMPLETE',
'UPDATE_ROLLBACK_FAILED',
],
})
);
return (
(listResult.StackSummaries?.filter((s) => s.StackName) as (StackSummary & {
StackName: string;
})[]) || []
);
I'm happy to PR this as well if that is easier and we're in agreement on the problem and solution. Open to thoughts + feedback on this.
Thanks for creating such a great platform for us and any help/insight is highly appreciated.reshma
07/22/2024, 11:42 PMreshma
07/22/2024, 11:43 PMdeeheber
07/23/2024, 12:56 AMrahul1
08/04/2024, 9:43 PM