[Unknown Interaction] from any deferReply, and from some editReply/reply

as an example of usage:
export class MyService {
constructor(@Inject('client') client: Client) {
this.client = client;
this.client.on('interactionCreate', this.onInteraction.bind(this));
}
async onInteraction(interaction: BaseInteraction) {
if (!interaction.isCommand()) return;
await interaction.deferReply({ ephemeral: true });
await this.serviceCommanbds.execute(interaction);
}
}
export class MyService {
constructor(@Inject('client') client: Client) {
this.client = client;
this.client.on('interactionCreate', this.onInteraction.bind(this));
}
async onInteraction(interaction: BaseInteraction) {
if (!interaction.isCommand()) return;
await interaction.deferReply({ ephemeral: true });
await this.serviceCommanbds.execute(interaction);
}
}
no matter where I put deferReply first 3-4 usage of command will trigger error, sometimes on 3+ usages it executes normally bot ping on host->discord 80-100ms, so it mustn't be a "long response"
6 Replies
d.js toolkit
d.js toolkit13mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
d.js docs
d.js docs13mo ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. - Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance) * Note: you cannot defer modal or autocomplete value responses
treble/luna
treble/luna13mo ago
3rd bullet point otherwise probably host or network issue
Satan1c
Satan1cOP13mo ago
I'm seeng the same on local I've no shards, and only one bot instance, so... there mustn't be more that one process
treble/luna
treble/luna13mo ago
or multiple instances of that class or you have a piece of code that takes too long
Satan1c
Satan1cOP13mo ago
piece of code that takes too long
as you can see, I'm directrly subscibe to event, so there no 'other' code before this...
multiple instances of that class
typedi Container creating it, so it must be a singleton I'm also start getting same errors on projects with 14.11 djs, that was created on aboyt 14.11 release, and we doesn't change anything in them, but before all was fine I do:
this.logger.log(LogLevel.Information, `before defer`);
try {
await interaction.deferReply({ ephemeral: true })
} catch {
this.logger.log(LogLevel.Information, `defer error`);
return;
}
this.logger.log(LogLevel.Information, `after defer`);
this.logger.log(LogLevel.Information, `before defer`);
try {
await interaction.deferReply({ ephemeral: true })
} catch {
this.logger.log(LogLevel.Information, `defer error`);
return;
}
this.logger.log(LogLevel.Information, `after defer`);
and I'm getting logs:
[03.10 18:39:55] [INFO]: before defer
[03.10 18:39:55] [ERRO]: [ClientEvents.error] DiscordAPIError[10062]
Unknown interaction
DiscordAPIError[10062]: Unknown interaction
. . .
[03.10 18:39:55] [INFO]: after defer
[03.10 18:39:55] [INFO]: before defer
[03.10 18:39:55] [ERRO]: [ClientEvents.error] DiscordAPIError[10062]
Unknown interaction
DiscordAPIError[10062]: Unknown interaction
. . .
[03.10 18:39:55] [INFO]: after defer
there single instance but... error was ignored, and wasn't VeryPolitelySmilingDoggo set await interaction.deferReply().catch(), and as before defer works fine and now it goes to further code more often
Want results from more Discord servers?
Add your server