'aws sns confirm subscription request processing issue
I am trying to implement the aws sns service for a bucket in s3 and i am following this document https://docs.aws.amazon.com/sns/latest/dg/SendMessageToHttp.html according to this there will be subscribe url in the request for the confirmation subscription which will be coming to the url that we provide, but i am receiving empty body in the request. I tried to log the body but gave me an empty object. and tried by using the bodyparser but same result.
here is my route that i am implementing.
router.post("/s3FileCallback", function (req, res) {
debugger;
var bodyParser = require('body-parser');
var app = express();
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json())
if (req.get("x-amz-sns-message-type") == "SubscriptionConfirmation") {
console.log("arn" + req.get("x-amz-sns-topic-arn"));
const subscribeUrl = req.body.SubscribeURL;
console.log("subscribeUrl" + subscribeUrl);
})
is there any thing i am missing. can any one point me in right direction please.
Solution 1:[1]
In case if you are using php, this should work
$res = file_get_contents('php://input');
file_put_contents('response.txt', $res. "\n", FILE_APPEND);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | dav |
