我在这里关注教程:https://docs.aws.amazon.com/toolkit-for-eclipse/v1/user-guide/lambda-tutorial.html#lambda-tutorial-invoke-function 我右键单击了我的编辑器,选择了AWS Lambda - >在AWS Lambda上运行函数,然后在输入框中,我尝试了以下但没有一个工作。
test
"test"
{"test", "value"}
我得到了这个例外:
==================== 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)
有人可以帮忙吗?我的输入有什么问题?是否有其他错误,但错误消息未指出?
如果我尝试{"key": "value"}
,我就会
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)
如果输入类型是字符串,基本上无法使其工作.....谢谢!
答案 0 :(得分:2)
它应该是一个json字符串试试:
{"key": "value"}
答案 1 :(得分:0)
不知道为什么,但现在开始使用"test"
......