Hi.
I’m trying to run the aws-csharp template. I manage to invoke it but when I try to call it through the API, it responds “Internal server error”. Calling functions through the API has worked with nodejs, python and java, but doesn’t work with C#. How can I make it work? What’s missing?
serverless.yml:
service: csharpExample
provider:
name: aws
runtime: dotnetcore1.0
package:
artifact: bin/release/netcoreapp1.0/deploy-package.zip
functions:
hello:
handler: CsharpHandlers::AwsDotnetCsharp.Handler::Hello
events:
- http: GET hello
Handler.cs:
using Amazon.Lambda.Core;
using System;
[assembly:LambdaSerializer(typeof(Amazon.Lambda.Serialization.Json.JsonSerializer))]
namespace AwsDotnetCsharp
{
public class Handler
{
public Response Hello(Request request)
{
return new Response(“Go Serverless v1.0! Your function executed successfully!”, request);
}
}
public class Response
{
public string Message {get; set;}
public Request Request {get; set;}
public Response(string message, Request request){
Message = message;
Request = request;
}
}
public class Request
{
public string Key1 {get; set;}
public string Key2 {get; set;}
public string Key3 {get; set;}
public Request(string key1, string key2, string key3){
Key1 = key1;
Key2 = key2;
Key3 = key3;
}
}
}