Converse.js: Can't login

Created on 3 Dec 2020  路  41Comments  路  Source: conversejs/converse.js

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

Most helpful comment

Looks fixed to me on HEAD
Thanks

All 41 comments

Same problem here with Chrome 86.0.4240.198
Uncaught (in promise) TypeError: this.setProtocol is not a function

git bisect says:

21dfd8a325dddd9575ced6f7713ccef4668b00f0 is the first bad commit
commit 21dfd8a325dddd9575ced6f7713ccef4668b00f0
Author: JC Brand
Date:   Mon Nov 30 17:54:06 2020 +0100

    Bugfix: Set protocol after discovering connection methods

    Otherwise if an endpoint was passed in with `converse.initialize`, then
    that endpoint's protocol is (wrongly) used.

:100644 100644 c472550e2b48cc8ce8298d88317ecb17143d255e 01445e0ff8f0e1cd5711d2ae0b3efa196a93bb0d M      package-lock.json
:040000 040000 ef98115c93ca6e923d0220ad4d983462535585a4 a8ed0efb71f3f5b38998578a07db135f24fc50b8 M      src

Your version of Strophe is out of date. You can run make clean && make dev again to fix that.

I am running converse.js self hosted, but not self compiled - using https://cdn.conversejs.org/dist/converse.min.js as script source.
What should I do?

@jcbrand self compiled here, make clean; make dist, updating via git pull

Will try...

@jcbrand umm, make dev does not minify it? What other differences are there?

make dist is fine, probably better for your usecase.

Well, dist was erroring out

I just did now a fresh clone, clean, dev, dist, just in case

Will report later

No joy, neither clean/dev/clean/dist nor clean/dev/dist work.

How do I check if Strophe is updated?

jc@lap:~/src/converse.js (master)$ cat node_modules/strophe.js/src/core.js  | grep setP
        this.setProtocol();
    /** Function: setProtocol
    setProtocol () {

@licaon-kter Try removing package-lock.json and src/headless/package-lock.json and then running make dist again.

I think the issue might be in the package-lock.json

I am still trying to understand what is going wrong on my end.
I'm using https://cdn.conversejs.org/dist/converse.min.js and I haven't changed anything on my end. Starting from today, I get this error. Can anyone please point me in the right direction?

@jcbrand

cat node_modules/strophe.js/src/core.js | grep setP

Same result here.

Try removing

make: *** No rule to make target 'src/headless/package-lock.json', needed by 'node_modules'. Stop.

Umm?

Still an issue on HEAD (https://github.com/conversejs/converse.js/commit/01e03fc677721803e9459ad3f54f5c9744b955a5)

Still an issue with https://github.com/conversejs/converse.js/commit/240fab99f4ef97328623f6028d8fa6dc73ade0c4
make dev (not minified) or make dist, no joy :(

not minified, Firefox stable, private tab, unchecked trusted:

14:39:27.837 Uncaught (in promise) TypeError: this.setProtocol is not a function
    onDomainDiscovered connection.js:56
    discoverConnectionMethods connection.js:85
    connect connection.js:102
    connect core.js:1157
    attemptNonPreboundSession core.js:1113
    login core.js:537
    connect loginpanel.js:157
    authenticate loginpanel.js:149
    handler view.js:188
    delegate view.js:193
    delegateEvents view.js:150
    setElement view.js:105
    _ensureElement view.js:253
    View view.js:44
    child helpers.js:32
    renderLoginPanel view.js:87
    renderLoginPanel register.js:57
    wrappedOverride pluggable.js:71
    Lodash 2
    render view.js:69
    initialize view.js:36
    View view.js:45
    child helpers.js:32
    child helpers.js:32
    controlbox_onChatBoxViewsInitialized index.js:29
    triggerEvents events.js:283
    triggerApi events.js:264
    eventsApi events.js:50
    trigger events.js:254
    _onModelEvent collection.js:671
    triggerEvents events.js:284
    triggerApi events.js:265
    eventsApi events.js:50
    trigger events.js:254
    set collection.js:215
    add collection.js:99
    addControlBox utils.js:5
    promise callback*initialize index.js:130
    initializePlugin pluggable.js:212
    loadPluginDependencies pluggable.js:148
    Lodash 2
    loadPluginDependencies pluggable.js:140
    initializePlugin pluggable.js:208
    Lodash 2
    initializePlugins pluggable.js:244
    initPlugins core.js:1043
    initialize core.js:1559
    initialize converse.js:87
    initialize entry.js:31
    <anonymous> (index):1
connection.js:56:17
    connect connection.js:104
    AsyncFunctionThrow self-hosted:678
    (Async: async)
    connect core.js:1157
    attemptNonPreboundSession core.js:1113
    login core.js:537
    InterpretGeneratorResume self-hosted:1468
    AsyncFunctionNext self-hosted:674
    (Async: async)
    connect loginpanel.js:157
    authenticate loginpanel.js:149
    authenticate self-hosted:1161
    handler view.js:188
    (Async: EventListener.handleEvent)
    delegate view.js:193
    delegateEvents view.js:150
    setElement view.js:105
    _ensureElement view.js:253
    View view.js:44
    child helpers.js:32
    renderLoginPanel view.js:87
    renderLoginPanel self-hosted:1161
    renderLoginPanel register.js:57
    wrappedOverride pluggable.js:71
    Lodash 2
    render view.js:69
    initialize view.js:36
    View view.js:45
    child helpers.js:32
    child helpers.js:32
    controlbox_onChatBoxViewsInitialized index.js:29
    triggerEvents events.js:283
    triggerApi events.js:264
    eventsApi events.js:50
    trigger events.js:254
    _onModelEvent collection.js:671
    triggerEvents events.js:284
    triggerApi events.js:265
    eventsApi events.js:50
    trigger events.js:254
    set collection.js:215
    add collection.js:99
    addControlBox utils.js:5
    (Async: promise callback)
    initialize index.js:130
    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
    initPlugins core.js:1043
    initialize core.js:1559
    AsyncFunctionNext self-hosted:674
    (Async: async)
    initialize converse.js:87
    initialize entry.js:31
    <anonymous> (index):1

I'm not able to reproduce this.

Here's my archive of HEAD:
conv.tar.zip

Thanks, I took a look.

Looks like you have two Strophes inside the bundle, one old and one new and the old one is being used, causing the error.

This must be some kind of bundling error. I'll see if I can find the cause.

One idea, since Protocol is mentioned (and see my bisect above), was to remove ./well-known and by magic, Converse fails to load ./well-known/host-meta but now it works. :)

index.html has:

websocket_url: 'wss://mydomain.tld/ws',

host-meta has:

<?xml version='1.0' encoding='utf-8'?>
<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0'>
  <Link rel="urn:xmpp:alt-connections:websocket"
        href="wss://mydomain.tld/ws" />
</XRD>

Yes, it works now because the setProtocol call is after getting the host-meta data.

@licaon-kter working now?

Nope, same result: works without host-meta, fails when that's present.

One question: why does it pull host-meta if I've already put websocket url in config?

Console log for the minified version:

09:59:20.011 Uncaught (in promise) TypeError: this.setProtocol is not a function
    onDomainDiscovered connection.js:56
    discoverConnectionMethods connection.js:85
    connect connection.js:102
    Wc core.js:1156
    login core.js:1112
    login core.js:535
    connect loginpanel.js:157
    authenticate loginpanel.js:149
    i view.js:188
    delegate view.js:193
    delegateEvents view.js:150
    setElement view.js:105
    _ensureElement view.js:253
    qd view.js:44
    r helpers.js:32
    renderLoginPanel view.js:87
    renderLoginPanel register.js:57
    wrappedOverride pluggable.js:71
    Lodash 2
    render view.js:69
    initialize view.js:36
    qd view.js:45
    r helpers.js:32
    r helpers.js:32
    _b index.js:29
    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
    $_ utils.js:5
    promise callback*initialize index.js:130
    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 core.js:1042
    initialize core.js:1558
    initialize converse.js:85
    initialize entry.js:31
    <anonymous> (index):1
connection.js:56:17
    connect connection.js:104
    AsyncFunctionThrow self-hosted:678
    (Async: async)
    Wc core.js:1156
    login core.js:1112
    login core.js:535
    InterpretGeneratorResume self-hosted:1468
    AsyncFunctionNext self-hosted:674
    (Async: async)
    connect loginpanel.js:157
    authenticate loginpanel.js:149
    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
    qd view.js:44
    r helpers.js:32
    renderLoginPanel view.js:87
    renderLoginPanel self-hosted:1161
    renderLoginPanel register.js:57
    wrappedOverride pluggable.js:71
    Lodash 2
    render view.js:69
    initialize view.js:36
    qd view.js:45
    r helpers.js:32
    r helpers.js:32
    _b index.js:29
    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
    $_ utils.js:5
    (Async: promise callback)
    initialize index.js:130
    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 core.js:1042
    initialize core.js:1558
    AsyncFunctionNext self-hosted:674
    (Async: async)
    initialize converse.js:85
    initialize entry.js:31
    <anonymous> (index):1

Nope, same result: works without host-meta, fails when that's present.

Did you run make clean first?

One question: why does it pull host-meta if I've already put websocket url in config?

Because discover_connection_methods is set to true and the websocket_url is used as fallback.

I always do clean before make.

Because discover_connection_methods is set to true and the websocket_url is used as fallback.

Right, setting discover_connection_methods: false fixes it also.

Can you share your files again?

Hi!

I have exactly the same problem. If you disable discover_connection_methods or prevent the metadata from being accessible then you can login. I have tried it with Firefox, Opera, Chromium,.. :/

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"]
});

I am running into same issue while using the dist files of the 7.0.4 release. Neither setting protocol discovery to false nor the plugin hack suggested above changed a thing. I used to run 6.0.0 just fine.

I'm having the same problem. version 7.0.3 did run fine, applying the converse-fix-connection-discovery addon works too.

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.

Looks fixed to me on HEAD
Thanks

I just tried d335a1111926276ae7eaca7fb089fd5a8755a509 on my setup with the following basic HTML snippet:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta chartset="utf-8"/>
  <link rel="stylesheet" type="text/css" media="screen" href="/dist/converse.css">
  <script src="/dist/signal.js" charset="utf-8"></script>
  <script src="/dist/converse.min.js" charset="utf-8"></script>
</head>
<body class="converse-fullscreen">
<div id="conversejs-bg"></div>

<script>
  converse.initialize({
      authentication: 'login',
      bosh_service_url: 'https://kack.it/.xmpp/http-bind/',
      view_mode: 'fullscreen',
  });
</script>
</body>
</html>

I am still seeing this:

connection.js:57 Uncaught (in promise) TypeError: this.setProtocol is not a function
    at Zs.onDomainDiscovered (connection.js:57)
    at async Zs.discoverConnectionMethods (connection.js:85)
    at async Zs.connect (connection.js:102)
onDomainDiscovered @ core.js:543
async function (async)
connect @ core.js:543
Tc @ converse.min.js:305
t.jid @ converse.min.js:305
login @ converse.min.js:305
async function (async)
login @ converse.min.js:305
connect @ api.js:32
authenticate @ api.js:32
i @ vcard.js:12

@andir: did you run make clean && make dev before testing?

Yes, this was a fresh checkout as before I always just used the release artifacts.

What do you mean release artifacts? You need to create new builds.

@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 馃槂

What do you mean release artifacts? You need to create new builds.

Those files that you serve on the "releases" page on GitHub. For example this one: https://github.com/conversejs/converse.js/releases/tag/v7.0.4

There is a file called "converse.js-7.0.4.tgz".

Just to be sure I also did the same exercise with a development build instead of a minified release build (via make dev instead of npm run build or whatever it was) and the result is the same:

connection.js:57 Uncaught (in promise) TypeError: this.setProtocol is not a function
    at connection_Connection.onDomainDiscovered (connection.js:57)
    at async connection_Connection.discoverConnectionMethods (connection.js:86)
    at async connection_Connection.connect (connection.js:103)

The HEAD (0777bd22b2810eee51b49857c0462a51231f4107) of the branch 7.x.x is working for me. Thanks!

Was this page helpful?
0 / 5 - 0 ratings