diff --git a/changelog.d/257.bugfix b/changelog.d/257.bugfix new file mode 100644 index 00000000..9218cb6e --- /dev/null +++ b/changelog.d/257.bugfix @@ -0,0 +1 @@ +Fix .toUpperCase() errors due to the bridge trying to handle unknown deleted messages diff --git a/src/SlackEventHandler.ts b/src/SlackEventHandler.ts index df9d02e1..38dec57c 100644 --- a/src/SlackEventHandler.ts +++ b/src/SlackEventHandler.ts @@ -120,6 +120,10 @@ export class SlackEventHandler extends BaseSlackHandler { this.main.incCounter("received_messages", {side: "remote"}); endTimer({outcome: "dropped"}); return; + } else if (err.message === "unknown_message") { + log.warn(`Ignoring event because we couldn't find a referred to message`); + endTimer({outcome: "dropped"}); + return; } else if (err.message === "unknown_event") { endTimer({outcome: "dropped"}); } else { @@ -213,6 +217,8 @@ export class SlackEventHandler extends BaseSlackHandler { const botClient = this.main.botIntent.getClient(); return botClient.redactEvent(originalEvent.roomId, originalEvent.eventId); } + // If we don't have the event + throw Error("unknown_message"); } else if (msg.subtype === "message_replied") { // Slack sends us one of these as well as a normal message event // when using RTM, so we ignore it.