AWS IOT createKeysAndCertificate给出网络失败错误
问题描述:
在下面的代码中,iot.listCertificates执行完美,我能够在AWS IOT控制台中看到所有证书,但是当我尝试执行命令iot.createKeysAndCertificate时,它会给我提供NETWORK FAILURE ERROR。AWS IOT createKeysAndCertificate给出网络失败错误
请帮我这个, 谢谢!
var params = {};
iot.listCertificates(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
alert("Attempting to create new thing!!");
params = {
setAsActive:false
};
iot.createKeysAndCertificate(params, function(err, data) {
if (err)
alert(err);
else
alert("New thing added to AWS IOT");
});
答
我刚刚在浏览器(Chrome 61)中试过了上面的代码,它成功地列出了证书并创建了新的证书。所以不要认为问题出在你的代码上。
也许尝试确保时钟在您提出请求的机器上正确。由于时钟关闭了几分钟,我看到一些AWS请求失败。他们也可能使用请求中的时间在证书上生成到期日期。