rahulpsd18 / cognito-backup-restore

AIO Tool for backing up and restoring AWS Cognito User Pools
MIT License
196 stars 63 forks source link

No email provided but desired delivery medium was Email #25

Open fredleger opened 4 years ago

fredleger commented 4 years ago

When restoring a users pool got the following error:

UnhandledPromiseRejectionWarning: InvalidParameterException: No email provided but desired delivery medium was Email
...
(node:61020) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:61020) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Both pools configured exactly the same with terraform creation.

Actually it seems doing the job one by one user and issue the error right after restoring it. It would be nice to have at least a "continue on error" option if some users are buggy

anilchalissery commented 1 year ago

Having the same issue. I created exact same 2 pools and was not able to import users all users together. It is working only per one user.

anilchalissery commented 1 year ago

image

I was able to fix the error UnhandledPromiseRejectionWarning: InvalidParameterException: No email provided but desired delivery medium was Email by commenting that part.

instead of } else if (UsernameAttributes.includes('phone_number')) { params.Username = pluckValue(user.Attributes, 'phone_number') as string; params.DesiredDeliveryMediums = ['EMAIL', 'SMS'] }

i changed to } else if (UsernameAttributes.includes('phone_number')) { params.Username = pluckValue(user.Attributes, 'phone_number') as string; params.DesiredDeliveryMediums = ['SMS'] }

Then run with npm start where we can run cbr cli commands

NOTE: THIS WILL SEND SMS TO ALL THOSE USERS IMPORTED. TO AVOID THIS YOU CAN SET SNS SPEND LIMIT AS $1 OR $0, SO THAT IT CANT SEND SMS.

Hope it helps