我正在尝试使用node.js和通过AWS发送SMS。我收到以下错误
originalError:
{ Error: getaddrinfo ENOTFOUND sns.southeast-2.amazonaws.com sns.southeast-2.amazonaws.com:443
at errnoException (dns.js:53:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:95:26)
message: 'getaddrinfo ENOTFOUND sns.southeast-2.amazonaws.com sns.southeast-2.amazonaws.com:443',
code: 'NetworkingError',
errno: 'ENOTFOUND',
syscall: 'getaddrinfo',
hostname: 'sns.southeast-2.amazonaws.com',
host: 'sns.southeast-2.amazonaws.com',
port: 443,
region: 'southeast-2',
retryable: true,
time: 2018-08-31T12:35:52.241Z },
时间:2018-08-31T12:35:52.241Z}
我的代码在下面...
var AWS = require('aws-sdk');
AWS.config.update({
accessKeyId: 'AKIAIUZOX3xxxxxxxxxx',
secretAccessKey: 'xxxxj2t1y22qxxxxxxxxxx2vf6KyFiV7Txxxx',
region: 'southeast-2'
});
var sns = new AWS.SNS();
var SNS_TOPIC_ARN = 'arn:aws:sns:ap-southeast-2:82688246XXXX:xxx';
var to_number = '917980981798';
sns.subscribe({
Protocol: 'sms',
TopicArn: SNS_TOPIC_ARN,
Endpoint: to_number,
Topicowner: '826882469571',
endpoint : '+917980981798'
}, function(error, data) {
if (error) {
console.log("error when subscribe", error);
}
var params = {
TargetArn: SNS_TOPIC_ARN,
Message: 'test message',
//hardcode now
Subject: 'Admin'
};
sns.publish(params, function(err_publish, data) {
if (err_publish) {
console.log('Error sending a message', err_publish);
} else {
console.log('Sent message:', data.MessageId);
}
});
});
我没有收到短信。我应该在哪里改变?我必须在AWS服务器上进行更改吗?
答案 0 :(得分:0)
您的地区不正确,应该是<IconTabBar id="TabFilterBar">
<items>
<IconTabFilter id="TabFilterOne" icon="sap-icon://database" iconColor="Neutral" text="{i18n>TabFilterOne}" count="{/TestDataSet(Systemid='{filterModel>systemid}', Version='{filterModel>version}')/Value1}"/>
<IconTabFilter id="TabFilterTwo" icon="sap-icon://check-availability" iconColor="Neutral" text="{i18n>TabFilterTwo}" count="{/TestDataSet(Systemid='{filterModel>systemid}', Version='{filterModel>version}')/Value2}"/>
</items>
而不是ap-southeast-2
答案 1 :(得分:0)
您可以使用AWS Command-Line Interface (CLI)测试短信的发送:
aws sns publish --phone-number (In +Intl format) --message Foo
这将检查SMS是否与您的电话号码配合使用,以及您的AWS凭证是否具有通过Amazon SNS发送SMS的必要权限。