User Migration to Cognito using Lambda trigger in python

杀马特。学长 韩版系。学妹 提交于 2019-12-05 14:13:36

The issue was in the event object, here's what I've changed to get this to work: removed the line

"desiredDeliveryMediums": "EMAIL",

because that's conflic with the parameter - "messageAction": "SUPPRESS".

Also

"forceAliasCreation": "false" 

is not necessary, as false is the default value. There should also be a test to check if username/email don't already exist in the user pool.

I tested with following code in my User Pool, it works.

def lambda_handler(event, context):
    ## print("migrateUserLambda Python")

    event["response"] = {
            "userAttributes": {
                "email": event["userName"],
                "email_verified": "true"
            },
            "finalUserStatus": "CONFIRMED",
            "messageAction": "SUPPRESS"
        }

    return event  
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!