node.js - 在 AWS 中 SNS 提供的 header 列表中未收到订阅 URL?

标签 node.js amazon-web-services amazon-sns restify

因此,我使用restifyJS 来接收SNS 通知,并为其创建了一个主题并使用适当的ARN 订阅了它。我使用了 https 端点,当我请求确认时,我会收到以下 header 。

{ 
  connection: 'upgrade',
  'x-real-ip': '*****************My IP address *****************',
  'x-forwarded-for': '*************My IP address ************',
  host: 'localhost:3000',
  'content-length': '1530',
  'x-amz-sns-message-type': 'SubscriptionConfirmation',
  'x-amz-sns-message-id': '*************************************',
  'x-amz-sns-topic-arn': 'arn:aws:sns:ap-south - ************',
  'content-type': 'text/plain; charset=UTF-8',
  'user-agent': 'Amazon Simple Notification Service Agent',
  'accept-encoding': 'gzip,deflate' 
  }

但我没有获得订阅 URL。

最佳答案

如上所述,URL 位于请求正文中。另请注意,主体是 JSON,但内容类型设置为 text/plain,这可能会导致某些解析器提供空请求主体。 您可以为 Restify 提供一个文本/纯格式格式化程序,根据“x-amz-sns-message-type” header 的存在情况来解析 SNS 消息的 json 内容。

关于node.js - 在 AWS 中 SNS 提供的 header 列表中未收到订阅 URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52812374/

相关文章:

node.js - 如何使用 zlib 和 nodejs 压缩和解压缩 .tar.gz

javascript - 使用 Passport 的 Node.js 用户身份验证

python - Apache2 错误日志。调用 'site.addsitedir()' 失败 '(null)' ,停止

javascript - AMAZON SNS 使用 Node js 将通知有效负载推送到 Android 手机

json - 亚马逊社交网络 : JSON toasts to Windows Phones

javascript - 将 node-webkit 作为 node.js 应用程序运行

javascript - SailsJS 覆盖模型方法

amazon-ec2 - 适用于作业服务器的Amazon Auto Scaling API

mysql - 在 Tableau 中将现有工作簿从 Oracle 重新指向 AWS-RDS?

node.js - AWS - SNS - 如何在每次调用的基础上设置发送者?