Web-kore-sdk is giving error in Microsoft edge "Unable to get property 'botOptions' of undefined or null reference"


(Priyanshu Shukla) #1

I am trying to integrate bot with webapp. It is working fine with google chrome & firefox. But when i run index.html in microsoft edge & safari, it shows the following error:
jQuery.Deferred exception: Unable to get property ‘botOptions’ of undefined or null reference TypeError: Unable to get property ‘botOptions’ of undefined or null reference
at Anonymous function (file:///F:/Priyanshu/kh/Chatbot/sdk/UI/kore-main.js:75:9)
at mightThrow (file:///F:/Priyanshu/kh/Chatbot/sdk/UI/libs/jquery.js:3534:10)
at Anonymous function (file:///F:/Priyanshu/kh/Chatbot/sdk/UI/libs/jquery.js:3602:12) undefined


Kore-main.js Code


    $(document).ready(function () {

        function assertion(options, callback) {
            var jsonData = {
                "clientId": options.clientId,
                "clientSecret": options.clientSecret,
                "identity": options.userIdentity,
                "aud": "",
                "isAnonymous": true

            options.assertion = generateJWT(jsonData);
        options.handleError = koreBot.showError;
        options.botDetails = koreBot.botDetails;
        options.chatHistory = koreBot.chatHistory;
        callback(null, options);
        setTimeout(function () {
            if (koreBot && koreBot.initToken) {
        }, 2000);
        function generateJWT(options) {
            // Header
            var oHeader = {alg: 'HS256', typ: 'JWT'};
            // Payload
            var oPayload = {};
            var tNow = KJUR.jws.IntDate.get('now');
            var tEnd = KJUR.jws.IntDate.get('now + 1day');
            oPayload.iss = options.clientId;
            oPayload.sub = options.identity;
            oPayload.iat = tNow;
            oPayload.exp = tEnd;
            oPayload.aud = options.aud || "https://idproxy.kore.com/authorize";
            oPayload.isAnonymous = options.isAnonymous || false;
            // Sign JWT
            var sHeader = JSON.stringify(oHeader);
            var sPayload = JSON.stringify(oPayload);
            var sJWT = KJUR.jws.JWS.sign("HS256", sHeader, sPayload, options.clientSecret);
            return sJWT;

/* commented below lines because already sending JWT in above lines.           
                url: options.JWTUrl,
                type: 'post',
                data: jsonData,
                dataType: 'json',
                success: function (data) {
                    options.assertion = data.jwt;
                    options.handleError = koreBot.showError;
                    options.chatHistory = koreBot.chatHistory;
                    options.botDetails = koreBot.botDetails;
                    callback(null, options);
                    setTimeout(function () {
                        if (koreBot && koreBot.initToken) {
                    }, 2000);
                error: function (err) {
        var chatConfig=window.KoreSDK.chatConfig;
        var koreBot = koreBotChat();
        $('.openChatWindow').click(function () {

})(jQuery || (window.KoreSDK && window.KoreSDK.dependencies && window.KoreSDK.dependencies.jQuery));

Please help.

(sadhvi chandra) #2

Hi Priyanshu,

We tested the same on Microsoft edge (version 81.0.416.64) and safari (version 13.1)

The issue is microsoft edge & safari specific. Had it been an SDK issue it would be the same with every browser. The possible issue could be because of the versions of the browsers used.

Here is the link for the list of browsers along with the versions, which are supported by kore.ai

We would like to suggest you to clear the browser cache.

Few browsers have limited support for HTML5/ Advanced JavaScript elements. Due to this, processing of the Java Scripts may be delayed. This ‘may’ lead to Invalid State Error. After cache clearing , any previous client side scripts could have been cleared and issue could have been removed. Initially if the logged in user does not have permission to remove some cache elements, it has to be done through scripts (which generally run as admin). That may explain why you had to use a script to clear cache.

(Priyanshu Shukla) #3

Hi Sadhvi,

I did some debugging, then this error disappeared. But again I got one more error

TypeError: leftScrollBtn[0] is undefined at chatWindow.js: 719:29

I resolved this error by writing that error line inside if condition.

if(leftScrollBtn[0] !== undefined) {

Now this error is resolved.

Thanks Sadhvi for help.