Skip to content

fix(bot): use ephemeral message flags and log the age of unacknowledged interactions - #13

Merged
Nxssie merged 1 commit into
mainfrom
fix/interaction-ack-flags
Oct 22, 2026
Merged

Nxssie merged 1 commit into
mainfrom
fix/interaction-ack-flags

Conversation

@Nxssie

@Nxssie Nxssie commented Oct 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace the deprecated ephemeral: true option with flags: MessageFlags.Ephemeral on every reply, follow-up, and the initial deferReply. This removes the discord.js deprecation warning from the logs.
  • When the initial deferReply fails, log how old the interaction was (Date.now() - interaction.createdTimestamp).

Why

Production logged 10062 Unknown interaction while acknowledging /search. deferReply is already the first await in InteractionCreate, so the interaction expired before the handler ran. Handler code is not the cause.

The logged age tells us where to look next:

  • ≥ 3000 ms: the event arrived late or the event loop stalled. Suspects are the synchronous local libSQL driver, parsing large yt-dlp -J payloads, or CPU contention in the container.
  • Well under 3000 ms: the interaction expired for another reason and needs separate investigation.

This PR does not fix the 10062 itself. It only adds the log needed to find the cause.

Changes

  • packages/server/src/index.ts: flags migration and the age in the acknowledgment error log
  • packages/server/src/lib/ackws up withMessageFlags.Ephemeral`
  • packages/server/src/lib/ack.test.ts: fake interaction updated to the new option shape

Test plan

  • bun test: 84 pass, 0 fail
  • bun build src/index.ts --target bun succeeds
  • Deploy and confirm the deprecation warning is gone
  • On the next 10062, read the age in the log

…ed interactions

Discord.js deprecated the ephemeral option in favor of MessageFlags.Ephemeral. When the defer fails with 10062, log how old the interaction was so a late delivery or a stalled event loop can be told apart from other expiries.
@Nxssie
Nxssie merged commit 6ea8deb into main Oct 22, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant