Skip to content

bug: Error when creating multiple reliable channels #2759

@nxtnish

Description

@nxtnish

Description

When creating more than one reliable channel, we are getting

"Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'payload')".
    at ReliableChannel.processIncomingMessage (reliable_channel.js:242:86)
    at eval (reliable_channel.js:232:24)
    at eval (subscription.js:128:26)

Expected Behavior

Create mutliple reliable channels without any issues

Steps to Reproduce

  1. Create 2 reliable channels:
      const test = await wakuClient.join({name: "tester"});
      const test2 = await wakuClient.join({name: "tester2"});
  1. Send a message
   setTimeout(() => {
                        test2.sendMessage({text:"Hello"});
                    },5000)
  1. Error occurs

The join method looks like this:

   const symKey = this._hexToUint8Array(await this._toSymHeyKey(secret));
        const routingInfo = AutoShardingRoutingInfo.fromContentTopic(this.topic, DefaultNetworkConfig);

        const encoder = createEncoderSymmetric({contentTopic: this.topic, symKey, routingInfo, ephemeral: true, sigPrivKey: this.ownKeys.bytes.privateKey});
        const decoder = createDecoderSymmetric(this.topic, routingInfo, symKey);

        const _wakuChannel = await ReliableChannel.create(this.lightNode, name, this.senderId, encoder, decoder);

...and the send method like this:

         const protoMessage = this.dataPacket.create({
                id: random(),
                sender: this.senderId,
                payload: new TextEncoder().encode(JSON.stringify(payload))
            });

            const serialisedMessage = this.dataPacket.encode(protoMessage).finish();
            const messageId = _wakuChannel.send(serialisedMessage);

Everything works fine as long as we only have 1 active channel.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions