Skip to content

"Error deserializing the input JSON" on completely stock empty function template #394

@nholms

Description

@nholms

Created an "Empty Function" new solution with VS2017 using AWS Toolkit templates. Making no changes to the generated solution I run the "Mock Lambda Test Tool" launch profile and select the "Hello World" example request.

{
  "key1": "value1",
  "key2": "value2",
  "key3": "value3"
}

The resulting error is below... I'm having trouble trying to identify the root cause and solution.

System.Exception: Error deserializing the input JSON to type String
   at Amazon.Lambda.TestTool.Runtime.LambdaExecutor.BuildParameters(ExecutionRequest request, ILambdaContext context) in E:\JenkinsWorkspaces\Lam\LambdaSandboxCoreCLRApi\Tools\LambdaTestTool\Amazon.Lambda.TestTool\Runtime\LambdaExecutor.cs:line 201
   at Amazon.Lambda.TestTool.Runtime.LambdaExecutor.Execute(ExecutionRequest request) in E:\JenkinsWorkspaces\Lam\LambdaSandboxCoreCLRApi\Tools\LambdaTestTool\Amazon.Lambda.TestTool\Runtime\LambdaExecutor.cs:line 44
---------------- Inner 1 Exception ------------
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at Amazon.Lambda.TestTool.Runtime.LambdaExecutor.BuildParameters(ExecutionRequest request, ILambdaContext context) in E:\JenkinsWorkspaces\Lam\LambdaSandboxCoreCLRApi\Tools\LambdaTestTool\Amazon.Lambda.TestTool\Runtime\LambdaExecutor.cs:line 193
---------------- Inner 2 Exception ------------
Amazon.Lambda.Serialization.Json.JsonSerializerException: 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: Unexpected character encountered while parsing value: {. Path '', line 1, position 1.
   at Amazon.Lambda.Serialization.Json.JsonSerializer.Deserialize[T](Stream requestStream)
---------------- Inner 3 Exception ------------
Newtonsoft.Json.JsonReaderException: Unexpected character encountered while parsing value: {. Path '', line 1, position 1.
   at Newtonsoft.Json.JsonTextReader.ReadStringValue(ReadType readType)
   at Newtonsoft.Json.JsonTextReader.ReadAsString()
   at Newtonsoft.Json.JsonReader.ReadForType(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 Amazon.Lambda.Serialization.Json.JsonSerializer.Deserialize[T](Stream requestStream)

Metadata

Metadata

Assignees

No one assigned

    Labels

    guidanceQuestion that needs advice or information.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions