提问人:Shekar Tippur 提问时间:1/19/2017 最后编辑:Prasad KhodeShekar Tippur 更新时间:1/19/2017 访问量:2396
AWS SNS 发布 404 错误
AWS SNS publish 404 error
问:
我有一个 lambda 函数,我正在尝试将消息发布到 SNS 主题:
代码如下:
var params = {
Message: origmessage,
Subject: "Retrying posting URL",
TopicArn: "arn:aws:sns:us-west-2:<acctid>:SampleTopic"
};
sns.publish(params, function(err, data) {
if (err) {
console.log("SNS publish error")
console.log(err, err.stack)
console.log(data, data)
console.log("RETRY PARAMS:" + params);
context.fail(err);
}
});
SNS发布错误很神秘,因为我无法找到根本原因。如果有人能帮我展示一种调试方法,将不胜感激。
这是错误:
2017-01-19T00:41:13.947Z d440064d-dddf-11e6-abad-8de6d2739d36 {
[404: null]
message: null,
code: 404,
time: Thu Jan 19 2017 00:41:13 GMT+0000 (UTC),
requestId: '0ENTKJ09RT82VE0SFEUJKT75NVVV4KQNSO5AEMVJF66Q9ASUAAJG',
statusCode: 404,
retryable: false,
retryDelay: 26.97333029936999
}
'404: null
at Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/query.js:45:29)
at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:670:12)
at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:115:18)'
答:
2赞
Matt Houser
1/19/2017
#1
根据您的评论,当您使用 时,它会影响所有服务。AWS.config.update
通过将参数设置为 dynamodb 终端节点,您可以为所有服务(包括 SNS)设置该终端节点。endpoint
这是一个令人反感的例子,它说要指定 for dynamodb:endpoint
相反,终结点应该从每个服务的构造函数中取出并以某种方式指定。AWS.config.update
评论
0赞
Shekar Tippur
1/19/2017
是的。AWS configs var AWS = require(“aws-sdk”);AWS.config.update({ region: “us-west-2”, endpoint: “dynamodb.us-west-2.amazonaws.com” });var docClient = 新 AWS。DynamoDB.DocumentClient();var sns = 新的 AWS。SNS({apiVersion: '2010-03-31'});
1赞
Matt Houser
1/19/2017
我想知道它是否与您的参数有关。如果你尝试删除它怎么办?endpoint
update
评论