0

Im trying to create a golang module that backs up a cognito userpool ! I fell on an error that says :

error creating users: operation error Cognito Identity Provider: AdminCreateUser, https response error StatusCode: 400, RequestID: ce4c6aba-badd-4edc-8767-5ee3337abab0, InvalidParameterException: Cannot modify the non-mutable attribute sub

Although, seen terraform aws documentation, "sub" attribute needs to be non-mutable! is there anyway I could fix that?

thank you.

MBA
  • 353
  • 2
  • 11
  • try by adding attribute back. Refer this link it might help you : https://stackoverflow.com/questions/51718209/aws-cognito-users-lost-non-mutable-attribute-email-verified and https://github.com/aws-amplify/aws-sdk-ios/issues/2203 – Ashutosh Singh Dec 27 '21 at 12:41

1 Answers1

0

sub is a special attribute. You can not modify the sub even if you have not mentioned sub as non-mutable, while creating the user pool. sub is always non-mutable and only Cognito service can create this attribute and assign it to a user.

I understand that you are creating backup of users in a new user pool. I would like to mention, a sub value is specific to an user pool. If you create a user in new userpool, then the sub value will be different for that user, and Cognito will generate that value (you can not provide it with AdminCreateUser API call). However, in the new userpool you can create a custom attribute called old_sub and can store the sub value of the other user pool.

Cloudy
  • 13
  • 4