Read a SNS message at AWS Lambda Function written in C#

Viewed 6373

I have a lambda function at AWS written in c#. This lambda function would read an incoming SNS message. Below is my lambda code.

public void FunctionHandler(Amazon.Lambda.SNSEvents.SNSEvent.SNSMessage message, ILambdaContext context)
        {                  
            if (message.Message == null)
            {
                Console.WriteLine("message is null");
            }
            else if (message.Message == string.Empty)
            {
                Console.WriteLine("message is empty");
            }
            else
            {
              Console.WriteLine(message.Message);
            }
       }
    }

I have subscribed this lambda function to a SNS Topic. The lambda function is triggered when I publish the SNS message, but the message is always shown null. i.e the output I am getting is :

message is null

Can anyone help me in reading the SNS message?

1 Answers
Related