In the below code iot.listCertificates executes perfectly and i am able to see all certificates in AWS IOT console but when I try to execute command iot.createKeysAndCertificate it gives me NETWORK FAILURE ERROR.
Please help me with this, Thank You!!
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");
});
I just tried your code above from within a browser (Chrome 61) and it successfully listed the certificates and create new ones. So don't think the issue is with your code.
Maybe try ensuring the clock is correct on the machine your making the request from. I've see some AWS request fail due to the clock being off by a few minutes. They might also use the time in the request to generate the expiration date on the certificate.