DataCloneError error in JavaScript SDK when client reconnects

Hello,

While using the JavaScript SDK we're often seeing the following error:

DataCloneError: Event object could not be cloned

After some investigation I was able to track down this behavior to a callback defined in the websocket worker onerror listener that tries to send an websocket error event.

WebSocket types cannot be cloned which results in the aforementioned error.

Verifying the minified genesys.min.js file we can see the precise place where this behavior is being defined.

function n() {
    e.command("GenesysVendors.WebSocket").then((function(n) {
        var r = (t.data || {}).endPoint;
        a && a.removeAllListeners(),
        (a = new n(r)).open().then((function(n) {
            a && (a.onMessage.addListener((function(t) {
                e.publish("onWebSocketMessage", JSON.parse(t))
            })), a.onClose.addListener((function(t) {
                e.publish("onWebSocketClose", {
                    code: t.code,
                    reason: t.reason,
                    returnValue: t.returnValue,
                    timeStamp: t.timeStamp,
                    type: t.type,
                    wasClean: t.wasClean
                })
            })), a.onError.addListener((function(t) {
                "object" === O(t) ? e.publish("onWebSocketError", t) : "string" == typeof t && e.publish("onWebSocketError", JSON.parse({
                    error: t
                }))
            })));
            var r = Object(u.h)(n);
            t.resolve(r)
        })).catch((function(e) {
            t.reject(e)
        }))
    })).catch((function(e) {
        var n = e.error;
        t.reject(n)
    }))
}

Is this a known issue and is there a workaround for it? Thanks.

Hi @gqgs, thank you for bringing this up along with the analysis. We will look into it and address it in our upcoming releases. There isn't any work around out of the box.

1 Like

Thanks for the response, Ranjith. Looking forward for this being fixed.
Is there any ETA the team can give for being able to look into this?

Hi @gqgs, fix is in progress for this error. With upcoming holidays at the end of the year, our next release is planned in the 2nd or 3rd week of Jan 2024 that will include resolving this.

Gotcha. Thanks for the update.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.