1

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.
...
```
zirkelc
  • 1,451
  • 1
  • 23
  • 49
  • 1
    Can you please share how you're doing these calls? – Ermiya Eskandary Jul 23 '22 at 08:43
  • I added a test repo to my question. I'm using the `@aws-sdk/client-cognito-identity-provider` to create/get/delete the groups. – zirkelc Jul 24 '22 at 14:49
  • 1
    I don't have an answer for you, but I arrived here trying to address the same problem. The way the Cognito API is implemented suggests it's using DynamoDB internally, which *could* be using eventually consistent writes/reads. Just a hunch, but I'm going down the same path you are – Seth Geoghegan Aug 24 '22 at 21:21
  • That could well be the reason. I opened an issue on the AWS SDK repo and they are investigating it: https://github.com/aws/aws-sdk-js-v3/issues/3825 – zirkelc Aug 25 '22 at 12:46

0 Answers0