amazon-web-servicesaws-lambdaamazon-cognitoamazon-cognito-triggers

What are you supposed to return from a lambda trigger function of type "Post confirmation trigger" in c#?


I am working on creating a user record in my database that corresponds to a user in my cognito pool. The code works fine, but in the fronted i keep receiving an error saying "Unrecognizable lambda output"

I have tried returning the context as I have seen examples of in js but all i get is the same error.

public ILambdaContext Get(CognitoPostConfirmation cognitoPostConfirmation, ILambdaContext context)
{

    var newUser = {name = "name"};

    try
    {
        \_collection.InsertOne(newUser);
    }
    catch
    {
        context.Logger.LogInformation("Failed to ");
    }

    return context;
}

I tried returning both the following object or a string but same problem:

public class EventResponse
{
    public int StatusCode { get; set; }
    public object Body { get; set; }
}

What are you supposed to return from this type of lambda function?


Solution

  • Turns out you need to return the event so in this case return cognitoPostConfirmation did the trick. Thought I had tried that already but apparently not