【发布时间】:2017-04-27 18:14:55
【问题描述】:
我在 C# 中有一个 Lambda 函数。当我在 Lambda 中的 Actions -> Test Data 下我有这个 json(为了人性而简化):
{
"address": "http://website.com",
"ID": "18",
"pricingType": "INTERSTATE",
"reportID": "1443",
"XML": "<BASICSXMLSTUFF>"
}
单击“测试”时有效。但是当我使用 CloudWatch Cron 规则时,我无法弄清楚如何将此数据发送到函数。我试图将它放在 CloudWatch 中的“常量(JSON 文本)”字段中,但这似乎没有保存,并且当函数运行时,我得到了这个堆栈跟踪:
Unexpected character encountered while parsing value: [. Path 'resources', line 1, position 202.: JsonReaderException
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.PopulateDictionary(IDictionary dictionary, JsonReader reader, JsonDictionaryContract contract, JsonProperty containerProperty, String id)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)
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 )
如何使用 CloudWatch 规则将 json 传递给我的 lambda 函数?还是我完全错了?
【问题讨论】:
标签: c# amazon-web-services lambda amazon-cloudwatch