我在visual studio 2017中使用c#創建了一個aws lambda函數,我遇到了參數問題。我試圖得到'querystring參數' 但每次我在我的FunctionHandler中的一個參數,我得到這個錯誤。AWS Lambda中的JsonReaderException C#函數
{
"errorType": "JsonReaderException",
"errorMessage": "Unexpected character encountered while parsing value: {. Path '', line 1, position 1.",
"stackTrace": [
"at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)",
"at Newtonsoft.Json.JsonTextReader.ReadAsString()",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter)",
"at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)",
"at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)",
"at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)",
"at lambda_method(Closure , Stream , Stream , ContextInfo)"
]
}
這是我的示例代碼FunctionHandler:
public string FunctionHandler(APIGatewayProxyRequest request, ILambdaContext context)
{
var sample = GetParameters(request.QueryStringParameters, "sample");
return sample;
}
這有什麼錯呢?答案將非常感激。謝謝 !
UPDATE
什麼是你輸入的輸入拉姆達? – Kannaiyan
我通過API網關傳遞查詢參數。 – anonymous
您能否請您提供如何傳遞參數,我的意思是JSON值的格式 – msoliman