createkeysand certificate aws javascript

50 views Asked by At

I am implementing the following code using javascript in browser to create certificate and key pair:

    var iot = new AWS.Iot();
    function createCert(){
        var params = {
            setAsActive:false
        };
        iot.createKeysAndCertificate(params, function(err, data) {
            if (err) console.log(err, err.stack); // an error occurred
            else     console.log(data);           // successful response
        });
    };

and I am getting the ERROR as :

UnknownOperationException: null at Object.s [as extractError] (https://sdk.amazonaws.com/js/aws-sdk-2.106.0.min.js:42:24512) at constructor.o (https://sdk.amazonaws.com/js/aws-sdk-2.106.0.min.js:42:29401)

Please help me in resolving this error. Thank You

1

There are 1 answers

0
komal patel On

Seems like I had configured AWS for dynamoDB and the endpoint of AWS.Iot was not updated. Now, it works!!!