Error in lib-jitsi-meet during initJitsiConference


I’m trying to get a simple client working using the lib-jitsi-meet library.

I’m receiving a TypeError: Cannot read property ‘substr’ of null when calling initJitsiConference.

It’s coming from the second line in lib-jitsi-meet.
var n = i.Strophe.getNodeFromJid(this.connection.jid),
this.authenticatedUser || (n = n.substr(0, 8)),

n is null

connection looks like this.

I create the connection using the following.
// FYI stuffing everything in window. until I get it working

    const initOptions = {
      disableAudioLevels: true,
      desktopSharingChromeDisabled: false,
      desktopSharingChromeSources: ['screen', 'window'],
      desktopSharingChromeMinExtVersion: '0.1',
      desktopSharingFirefoxDisabled: true,

      .then(() => {
        let connection = null
        connection = new window.JitsiMeetJS.JitsiConnection(null, null, options)
        window.connection = connection






        window.JitsiMeetJS.createLocalTracks({ devices: ['audio', 'video'] })
          // .then(onLocalTracks)
          .catch(error => {
            throw error
      .catch(error => console.log(error))

And in the onConnectionSuccess callback.

 onConnectionSuccess() {
    const confOptions = {
      openBridgeChannel: true,

    const connection = window.connection
    let room = null
    room = connection.initJitsiConference('conference', confOptions)


FYI, options looks like this. discourse would let me post with mulitple links.

const options = {
      hosts: {
        domain: '',
        muc: '',
      bosh: '//',

      // clientNode removed so I can post in discourse


It looks like the this.connection.jid is empty.
are you using Prosody as your XMPP server and if yes then is the domain configured for anonymous authentication ?


Thanks Pawel, I forwarded this on to our backend team that is handling the server part.

I believe we are using Prosody. I had tried the same code hitting the are received the same result.

It feels like we need to send some authorization but not clear on how that works from the docs.


You have error in your JS.

This will not add the function onConnectionSuccess as event listener, but will execute it. And it will execute it before calling connect and that is the reason you see that error, you try to create a conference without been xmpp connected.
Just change it to be:


Thanks, @damencho. Didn’t even notice that. :slight_smile: Will try and see what happens.