title: Deploy .NET 5 AWS Lambda with Container Images using CDK: Internal Server Error
body: <p>I've created a new <a href="https://aws.amazon.com/blogs/developer/net-5-aws-lambda-support-with-container-images/" rel="nofollow noreferrer">.NET 5 AWS Lambda Function using Container Images</a> via the Visual Studio Project Template:</p>
  <img src="https://d2908q01vomqb2.cloudfront.net/0716d9708d321ffb6a00818614779e779925365c/2020/12/01/01-lb-cont-lambda-blueprints.png" width="500"/>
  <p>And now I want to deploy the Lambda Function and an ApiGateway using the CDK.</p>
  <p>I was able to get it deployed, but when I invoke the method, I get this <strong>error</strong>:</p>
  <pre><code>❯ iwr https://3l0xxxxxx.execute-api.us-west-2.amazonaws.com/prod/
  Invoke-WebRequest: {&quot;message&quot;: &quot;Internal server error&quot;}
  </code></pre>
  <p>This is what I have in my Stack:</p>
  <pre class="lang-cs prettyprint-override"><code>public class Dotnet5LambdaStack : Stack
  {
      internal Dotnet5LambdaStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
      {
          var dotnet5Lambda = new Amazon.CDK.AWS.Lambda.Function(this, &quot;dotnet5Lambda&quot;, new FunctionProps
          {
              Runtime = Runtime.FROM_IMAGE,
              // relative to the cdk.json file
              Code = Code.FromAssetImage(&quot;src/lambdaNet5&quot;),
              
              Handler = Handler.FROM_IMAGE
          });
  
          new LambdaRestApi(this, &quot;dotnet5ApiEndpoint&quot;, new LambdaRestApiProps
          {
              Handler = dotnet5Lambda
          });
      }
  }
  </code></pre>
  <p><strong>How do I fix my CDK Stack code so my Lambda + Api Gateway deploy correctly?</strong></p>