Roh*_*mar 4 amazon-sqs amazon-web-services aws-api-gateway
我在 WebHook 的特定标头中获得签名。我想在令牌主体或属性中将其传递给 SQS。我尝试过以下配置。它不起作用。请帮忙
详情如下:
AWS Service : Simple Queue Service (SQS)
HTTP method :POST
Path override :Account/QueueName?Action=SendMessage
Execution role :arn:aws:iam::Acc#:role
Content Handling :Passthrough
Body Mapping Templates :
Content-Type : application/json
{
"MessageBody" : {
"payload": $input.json('$'),
"x-api-key" : "$input.params('x-api-key')"
}
}
Instead of MessageBody, I also tried with "body".
Response I get :
{
"Error": {
"Code": "MissingParameter",
"Message": "The request must contain the parameter MessageBody.",
"Type": "Sender"
},
"RequestId": "d5fc3acf-18dc-5379-9af2-6b4cc42358f3"
}
Run Code Online (Sandbox Code Playgroud)
我缺少什么?请帮忙。我几乎花了一整天的时间试图弄清楚。
提前致谢。
我最近遇到了类似的问题,
我在集成请求中做了以下更改:
以下是我在映射模板中添加的代码片段:
Action=SendMessage&MessageBody={
"data" : $input.json('$'),
"headers": {
#foreach($param in $input.params().header.keySet())
"$param": "$util.escapeJavaScript($input.params().header.get($param))" #if($foreach.hasNext),#end
#end
}
}
Run Code Online (Sandbox Code Playgroud)
这对我有用,它开始在 SQS 中将标头和正文一起推送。
下面是被推送到队列中的示例消息:
{“数据”:{“body-key1”:“body-value-1”},“标头”:{“标头1”:“值1”
}}
所以这里发生的情况是,当我在没有任何查询参数的情况下在队列 URL 上发送 post 请求时,它直接从映射模板获取正文。
希望这个答案可以帮助任何人。
| 归档时间: |
|
| 查看次数: |
3197 次 |
| 最近记录: |