Issue
I was following the tutorial here: https://docs.aws.amazon.com/toolkit-for-eclipse/v1/user-guide/lambda-tutorial.html#lambda-tutorial-invoke-function I right clicked on my editor, chose AWS Lambda -> Run function on AWS Lambda, and then in the input box, I've tried the following but none of them worked.
test
"test"
{"test", "value"}
And I got this exception:
==================== INVOCATION ERROR ====================
com.amazonaws.services.lambda.model.InvalidRequestContentException: Could not parse request body into json: Invalid UTF-8 start byte 0x80
at [Source: [B@7c56c329; line: 1, column: 3] (Service: AWSLambda; Status Code: 400; Error Code: InvalidRequestContentException; Request ID: 9ecedb86-3310-11e8-9f00-4798fcb419ad)
Can anyone help? What's wrong with my input? Is there something else that is wrong but was not indicated by the error message?
If I try {"key": "value"}
, I got
An error occurred during JSON parsing: java.lang.RuntimeException
java.lang.RuntimeException: An error occurred during JSON parsing
Caused by: java.io.UncheckedIOException: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source: lambdainternal.util.NativeMemoryAsInputStream@4501b7af; line: 1, column: 1]
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token
at [Source: lambdainternal.util.NativeMemoryAsInputStream@4501b7af; line: 1, column: 1]
at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:148)
at com.fasterxml.jackson.databind.DeserializationContext.mappingException(DeserializationContext.java:857)
at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:62)
at com.fasterxml.jackson.databind.deser.std.StringDeserializer.deserialize(StringDeserializer.java:11)
at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1511)
at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1102)
Basically couldn't get it work if input type is a String..... Thanks!
Solution
No idea why, but it started working with "test"
now...
Answered By - Jiechao Wang
Answer Checked By - Katrina (JavaFixing Volunteer)