1
votes

I am trying to create an Alexa skill that pulls data from my website and the request errors out when I use HTTPS though is fine when using HTTPS on other sites that require an api key such as the New York Times. Here is a code snippet

    function url() {
    return "http://en.wikipedia.org/w/api.php?action=query&format=json&list=search&utf8=1&srsearch=Albert+Einstein"
}

    function url2() {
        return {
            url: "https://api.nytimes.com/svc/books/v3/lists.json",
            qs: {
                "api-key" : "8430ae194d0a446a8b1b9b9d607b2acc",
                "list" : "hardcover-fiction"
            }
        }
    }

function url3() {
    return "https://mywvc.test.wvc.org/Alexa/Index?question=where%20is%20free%20parking"
}

function getJSON(callback) {
    // HTTP - WIKPEDIA
    // request.get(url(), function(error, response, body) {
    //     var d = JSON.parse(body)
    //     var result = d.query.searchinfo.totalhits
    //     if (result > 0) {
    //         callback(result);
    //     } else {
    //         callback("ERROR")
    //     }
    // })

    // HTTPS with NYT
    // request.get(url2(), function(error, response, body) {
    //     var d = JSON.parse(body)
    //     var result = d.results
    //     if (result.length > 0) {
    //         callback(result[0].book_details[0].title)
    //     } else {
    //         callback("ERROR")
    //     }
    // })


    // HTTPS - WVC
     request.get(url3(), function(error, response, body) {
         var d = JSON.parse(body)
         var result = d.answer
         if (result > 0) {
             callback(result);
         } else {
             callback("ERROR")
         }
     })

}

enter image description here

1
What are you using to host the server?Hunter

1 Answers

0
votes

Your site has a problem either with security certification. Even in browser a security warning is shown and https is not working.

To get more information about this security error refer to the following page Mozilla support page for this error.

Try to update the security certificate of your site and make sure it is properly running in browser without any error. Then your problem will be solved in alexa as well.