Skip to content

[Bug]: Sending text with @meshtastic/core results in always sending to itself rather than destination #1020

@Nate53085

Description

@Nate53085

Before submitting

  • I have searched existing issues to make sure this bug hasn't already been reported
  • I have updated to the latest version of the software to verify the issue still exists
  • I have cleared cache/cookies/storage or tried in a private/incognito window (if applicable)

Hardware

Other

Connection Type

Serial

Local or Hosted

https://client.meshtastic.org

Firmware Version

2.7.15

Operating System

Macos

Browser

No response

Expected Behavior

I'm trying to send a text message via @meshtastic/core in response to recieving a text message:

meshDevice.events.onMessagePacket.subscribe(async (messagePacket: Types.PacketMetadata<string>) => {
      const response = "Ack"
      await meshDevice.sendText(response, messagePacket.from, true, messagePacket.channel)
    });

Actual Behavior

No matter what I put as destination, the client sets destination to itself. The following code example registers to listen to a text message and is intended to send a simple ack back to the sender. Instead, I see the sendText sent to itself over and over until it stack overflows

I've tried both messagePacket.from and messagePacket.from.toString(16)

Steps to Reproduce

Once you are connected to a device via serial, run the above JS

Relevant console output

b2a7cb8c
19:32:34:992    DEBUG   [iMeshDevice]   SendText 📤 Sending message to 2997341068 on channel 0
19:32:34:992    TRACE   [iMeshDevice]   SendPacket 📤 Sending TEXT_MESSAGE_APP to 2997341068
19:32:34:992    TRACE   [iMeshDevice]   HandleMeshPacket 📦 Received TEXT_MESSAGE_APP packet
message package
{
  id: 975740062,
  rxTime: 2026-03-05T19:32:34.000Z,
  type: 'direct',
  from: 2997341068,
  to: 2997341068,
  channel: 0,
  data: 'Ack'
}
b2a7cb8c
19:32:34:992    DEBUG   [iMeshDevice]   SendText 📤 Sending message to 2997341068 on channel 0
19:32:34:992    TRACE   [iMeshDevice]   SendPacket 📤 Sending TEXT_MESSAGE_APP to 2997341068
19:32:34:992    TRACE   [iMeshDevice]   HandleMeshPacket 📦 Received TEXT_MESSAGE_APP packet
message package
{
  id: 795716825,
  rxTime: 2026-03-05T19:32:34.000Z,
  type: 'direct',
  from: 2997341068,
  to: 2997341068,
  channel: 0,
  data: 'Ack'
}
b2a7cb8c
19:32:34:993    DEBUG   [iMeshDevice]   SendText 📤 Sending message to 2997341068 on channel 0
19:32:34:993    TRACE   [iMeshDevice]   SendPacket 📤 Sending TEXT_MESSAGE_APP to 2997341068
19:32:34:993    TRACE   [iMeshDevice]   HandleMeshPacket 📦 Received TEXT_MESSAGE_APP packet
message package
node:internal/util/inspect:1109
    if (!isStackOverflowError(err)) throw err;
         ^

RangeError: Maximum call stack size exceeded
    at formatRaw (node:internal/util/inspect:1109:10)
    at formatValue (node:internal/util/inspect:883:10)
    at inspect (node:internal/util/inspect:386:10)
    at formatWithOptionsInternal (node:internal/util/inspect:2349:40)
    at formatWithOptions (node:internal/util/inspect:2211:10)
    at console.value (node:internal/console/constructor:329:14)
    at console.log (node:internal/console/constructor:374:61)
    at SimpleEventDispatcher$2.<anonymous> (/Users/natebourgoin/source/weather/src/meshthing.ts:25:15)
    at Subscription.execute (/Users/natebourgoin/source/weather/node_modules/@meshtastic/core/dist/mod.js:11649:13)
    at SimpleEventDispatcher$2._dispatch (/Users/natebourgoin/source/weather/node_modules/@meshtastic/core/dist/mod.js:11841:9)

Node.js v22.13.1

Screenshots

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions