Uncaught TypeError: Cannot read property 'init' of undefined

Calling frappe.socket.init(); is failing with the following trace:

(index):1231 Uncaught TypeError: Cannot read property ‘init’ of undefined
at dashboard ((index):1231)
at (index):1388
at frappe-web.min.js:1035
at Array.forEach ()
at Object.trigger_ready (frappe-web.min.js:1034)
at HTMLDocument. (frappe-web.min.js:1169)
at HTMLDocument.dispatch (jquery-2.2.3.min.js:3)
at HTMLDocument.r.handle (jquery-2.2.3.min.js:3)
at Object.trigger (jquery-2.2.3.min.js:4)
at HTMLDocument. (jquery-2.2.3.min.js:4)

Here is the codes causing the error:

    frappe.require("assets/frappe/js/lib/socket.io.min.js");
    frappe.require("assets/frappe/js/frappe/socketio_client.js");
    if (window.dev_server) {
            	frappe.boot.socketio_port = '9001' //use socketio port shown when bench starts
    }
    frappe.socket.init();

I am sure this worked just yesterday. However, even reverting back to old commits is no help.
ERPNext: v9.0.4 (master)
Frappe Framework: v9.0.7 (master)
Any help would be appreciated

try using frappe.socketio.init()

Thanks it works

1 Like