converse.js: Can't login

HEAD (c0dc8c89154112bca1bb9f9bf2a87dbc4a4ce76e), trusted or not, Firefox 83

Uncaught (in promise) TypeError: this.setProtocol is not a function
    onDomainDiscovered connection.js:56
    discoverConnectionMethods connection.js:85
    connect connection.js:102
    Xc converse-core.js:1157
    login converse-core.js:1113
    login converse-core.js:536
    connect converse-controlbox.js:443
    authenticate converse-controlbox.js:435
    i view.js:188
    delegate view.js:193
    delegateEvents view.js:150
    setElement view.js:105
    _ensureElement view.js:253
    Ld view.js:44
    r helpers.js:32
    renderLoginPanel converse-controlbox.js:236
    renderLoginPanel converse-register.js:57
    wrappedOverride pluggable.js:71
    Lodash 2
    render converse-controlbox.js:218
    initialize converse-controlbox.js:185
    Ld view.js:45
    r helpers.js:32
    r helpers.js:32
    initialize converse-controlbox.js:546
    Ai events.js:283
    Ei events.js:264
    bi events.js:50
    trigger events.js:254
    _onModelEvent collection.js:671
    Ai events.js:284
    Ei events.js:265
    bi events.js:50
    trigger events.js:254
    set collection.js:215
    add collection.js:99
    e converse-controlbox.js:162
    promise callback*initialize converse-controlbox.js:566
    initializePlugin pluggable.js:212
    loadPluginDependencies pluggable.js:148
    Lodash 2
    loadPluginDependencies pluggable.js:140
    initializePlugin pluggable.js:208
    Lodash 2
    initializePlugins pluggable.js:244
    initialize converse-core.js:1043
    initialize converse-core.js:1559
    initialize converse.js:86
    initialize entry.js:31
    <anonymous> (index):1
connection.js:56:17
    connect connection.js:104
    AsyncFunctionThrow self-hosted:678
    (Async: async)
    Xc converse-core.js:1157
    login converse-core.js:1113
    login converse-core.js:536
    AsyncFunctionNext self-hosted:674
    (Async: async)
    connect converse-controlbox.js:443
    authenticate converse-controlbox.js:435
    authenticate self-hosted:1161
    i view.js:188
    (Async: EventListener.handleEvent)
    delegate view.js:193
    delegateEvents view.js:150
    setElement view.js:105
    _ensureElement view.js:253
    Ld view.js:44
    r helpers.js:32
    renderLoginPanel converse-controlbox.js:236
    renderLoginPanel self-hosted:1161
    renderLoginPanel converse-register.js:57
    wrappedOverride pluggable.js:71
    Lodash 2
    render converse-controlbox.js:218
    initialize converse-controlbox.js:185
    Ld view.js:45
    r helpers.js:32
    r helpers.js:32
    initialize converse-controlbox.js:546
    Ai events.js:283
    Ei events.js:264
    bi events.js:50
    trigger events.js:254
    _onModelEvent collection.js:671
    Ai events.js:284
    Ei events.js:265
    bi events.js:50
    trigger events.js:254
    set collection.js:215
    add collection.js:99
    e converse-controlbox.js:162
    (Async: promise callback)
    initialize converse-controlbox.js:566
    initialize self-hosted:1161
    initializePlugin pluggable.js:212
    loadPluginDependencies pluggable.js:148
    Lodash 2
    loadPluginDependencies pluggable.js:140
    initializePlugin pluggable.js:208
    initializePlugin self-hosted:1161
    Lodash 2
    initializePlugins pluggable.js:244
    initialize converse-core.js:1043
    initialize converse-core.js:1559
    AsyncFunctionNext self-hosted:674
    (Async: async)
    initialize converse.js:86
    initialize entry.js:31
    <anonymous> (index):1

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 41 (30 by maintainers)

Commits related to this issue

Most upvoted comments

Looks fixed to me on HEAD Thanks

@jcbrand would be good to have a new release build (artifact) anyway, as not everybody has nodejs and all the requirements on the target system to build from source 😃

I still think the problem is the same as I originally identified, that Strophe is being bundled twice because the view layer (i.e. the non-headless code) imports Strophe instead of using it from converse.env.

I found and updated two more places where this happens and I think it might now be fixed.

If someone in this thread is willing to give it another try (from the 7.x.x branch or from master) I’d be grateful.

I couldn’t fix that … if you need the discover_connection_methods, try creating a plugin to “monkey patch” strophe, like below

converse.plugins.add('converse-fix-connection-discovery', {
    "initialize": function () {
        converse.env.Strophe.Connection.prototype.setProtocol = function() {
            const proto = this.options.protocol || "";
            if (this.options.worker) {
                this._proto = new Strophe.WorkerWebsocket(this);
            } else if (this.service.indexOf("ws:") === 0 || this.service.indexOf("wss:") === 0 || proto.indexOf("ws") === 0) {
                this._proto = new Strophe.Websocket(this);
            } else {
                this._proto = new Strophe.Bosh(this);
            }
        };
    }
});

then on initialize, you can do

converse.initialize({
    //...
   "whitelisted_plugins": [ /* other plugins you have plus */ "converse-fix-connection-discovery"]
});