Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
736 views
in Technique[技术] by (71.8m points)

amazon web services - Dotnet Core AWS Lambda For Cognito Post Confirmation Trigger Completion

I use Cognito User Pools and for a Post Sign Up Confirmation Trigger I am writing a dotnet core lambda to do some followup work. I stared by simple logging out what I get in and do some work from there. Thing is I realised my logging out works but then when the Function should "finish" it fails to do so. It produces the following error - Code: InvalidLambdaResponseException, Message: Unrecognizable lambda output. Here is my FunctionHandler:

[assembly: LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
...
public async Task FunctionHandler(JObject input, ILambdaContext context)
{
    context.Logger.LogLine($"INPUT:{input}");
    //Do some work      
}

I can only find a NodeJS example for Post Confirmation Lambda Trigger:

exports.handler = (event, context, callback) => {
    console.log(event);

    if (event.request.userAttributes.email) {
            sendEmail(event.request.userAttributes.email, "Congratulations " + event.userName + ", you have been confirmed: ", function(status) {

            // Return to Amazon Cognito
            callback(null, event);
        });
    } else {
        // Nothing to do, the user's email ID is unknown
        callback(null, event);
    }
};

In this example, it's simple - You simple invoke the callback, but there is no such callback for the dotnet core handlers.

I have also tried changing the function to simply return a basic string like: return "OK";, but it also does not like that and gives me the same error.

How am I suppose to close of this process for the Lambda?

question from:https://stackoverflow.com/questions/65852290/dotnet-core-aws-lambda-for-cognito-post-confirmation-trigger-completion

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...