title: Calling AWS Lambda Function in C#
body: <p>I'm trying to run a Lambda function from a console application. The idea is for it to run a quick fire &amp; forget lambda function without waiting for lambda function to return. My code doesn't appear to be executing the lambda function at all though. I know the function works because I can run with the test. When I run the below code I just get a task cancelled exception.</p>
  
  <pre><code>var jsonSerializer = new JsonSerializer();
  var lambdaConfig = new AmazonLambdaConfig() { RegionEndpoint = RegionEndpoint.USEast2 };
  var lambdaClient = new AmazonLambdaClient(lambdaConfig);
  
  using (var memoryStream = new MemoryStream())
  {
      jsonSerializer.Serialize(myData, memoryStream);
      var lambdaRequest = new InvokeRequest
      {
          FunctionName = "MyFunction",
          InvocationType = "Event",
          PayloadStream = memoryStream
  };
  
  var result = Task.Run(async () =&gt; { return await lambdaClient.InvokeAsync(lambdaRequest); }).Result;
  </code></pre>
  
  <p>Does anyone have some insight into what I'm doing wrong?</p>
  
  <p>Thanks!</p>