I'm writing test cases that repeatedly call CreateGroup
, UpdateGroup
and DeleteGroup
for AWS Cognito and validate if these changes were successful by reading the respective group via GetGroup
via the AWS SDK for JS v3.
However, I noticed a strange behavior that a call to DeleteGroup
yield an ResourceNotFoundException
but a subsequent call to CreateGroup
yields an GroupExistsException
for the same group name.
It seems like the AWS Cognito API is eventually consistent, but I could't find any information online.
UPDATE:
I created a test repository to reproduce this issue: https://github.com/zirkelc/aws-cognito-groups
The UserPoolId
and region
must be changed to your own resources. Then this example can be started with npx ts-node index
and prints the following outputs:
$ npx ts-node index
create group
get group
delete group
create group
GroupExistsException A group with the name already exists.
get group
ResourceNotFoundException Group not found.
delete group
ResourceNotFoundException Group not found.
create group
GroupExistsException A group with the name already exists.
get group
ResourceNotFoundException Group not found.
delete group
ResourceNotFoundException Group not found.
...
```