With a simple C# AWS Lambda
public string FunctionHandler(string myParam1, ILambdaContext context)
{
return myParam1;
}
How should I pass parameters to an AWS Lambda function + API Gateway, via a browser GET request?
I'd like something like this for example:
https://[API ID].execute-api.[REGION].amazonaws.com/myFunc?myParam1=myValue1
In the browser it says {"message":"Internal Server Error"}
In the logs it says Error converting the Lambda event JSON payload to a string. JSON strings must be quoted, for example "Hello World" in order to be converted to a string: The JSON value could not be converted to System.String.
Without parameters it works, for example:
public string FunctionHandler(ILambdaContext context)
{
return Utf8Json.JsonSerializer.ToJsonString(context);
}
When sending a GET request in the browser https://[API ID].execute-api.[REGION].amazonaws.com/myFunc returns successfully {"AwsRequestId":"86ca2da9-438c-4865-8a0b-29d3ced37176","FunctionName":....