thomst08 / requestrr

Requestrr is a chatbot used to simplify using services like Sonarr/Radarr/Lidarr/Ombi/Overseerr via the use of chat. Current platform is Discord only, but the bot was built around the ideology of quick adaptation for new features as well as new platforms.
MIT License
244 stars 17 forks source link

"The application did not respond" error for first command then works after #39

Open imogen-ooo opened 4 months ago

imogen-ooo commented 4 months ago

hi, this error seems to be similar to #9 however i only have one instance set up connected to one server. it appears to need to "wake up" the bot or something as the first command essentially always fails, then a second command right after that will always work, subsequent commands seem to be working for any sustained activity after that, but if left for 5-10 minutes or more it seems to go back to this state,

here are some of the logs and what i am seeing:

[2024-07-11 11:42:23 +00:00] [111 /ConnectionCl] [Crit ] Connection terminated (4000, ''), reconnecting
[2024-07-11 15:38:19 +00:00] [111 /ConnectionCl] [Crit ] Connection terminated (4000, ''), reconnecting
fail: Requestrr.WebApi.RequestrrBot.ChatBot[0]
      Error while sending ping command: Not found: 404
      DSharpPlus.Exceptions.NotFoundException: Not found: 404
         at DSharpPlus.Net.DiscordApiClient.CreateInteractionResponseAsync(UInt64 interaction_id, String interaction_token, InteractionResponseType type, DiscordInteractionResponseBuilder builder)
         at Requestrr.WebApi.RequestrrBot.ChatClients.Discord.DiscordPingWorkFlow.HandlePingAsync() in D:\Users\thoms\Documents\GitHub\requestrr\Requestrr.WebApi\RequestrrBot\ChatClients\Discord\DiscordPingWorkFlow.cs:line 22
         at Requestrr.WebApi.RequestrrBot.SlashCommands.Ping(InteractionContext ctx)
fail: Requestrr.WebApi.RequestrrBot.ChatBot[0]
      Error while sending ping command: Not found: 404
      DSharpPlus.Exceptions.NotFoundException: Not found: 404
         at DSharpPlus.Net.DiscordApiClient.CreateInteractionResponseAsync(UInt64 interaction_id, String interaction_token, InteractionResponseType type, DiscordInteractionResponseBuilder builder)
         at Requestrr.WebApi.RequestrrBot.ChatClients.Discord.DiscordPingWorkFlow.HandlePingAsync() in D:\Users\thoms\Documents\GitHub\requestrr\Requestrr.WebApi\RequestrrBot\ChatClients\Discord\DiscordPingWorkFlow.cs:line 23
         at Requestrr.WebApi.RequestrrBot.SlashCommands.Ping(InteractionContext ctx)
[2024-07-11 16:09:27 +00:00] [101 /Startup     ] [Info ] DSharpPlus, version 4.4.6+3a90ac8625573943ffe930a328de81180ad193dd
[2024-07-11 16:09:37 +00:00] [111 /ConnectionCl] [Info ] Connection terminated (1000, '')
fail: Requestrr.WebApi.RequestrrBot.ChatBot[0]
      Error while sending ping command: Not found: 404
      DSharpPlus.Exceptions.NotFoundException: Not found: 404
         at DSharpPlus.Net.DiscordApiClient.CreateInteractionResponseAsync(UInt64 interaction_id, String interaction_token, InteractionResponseType type, DiscordInteractionResponseBuilder builder)
         at Requestrr.WebApi.RequestrrBot.ChatClients.Discord.DiscordPingWorkFlow.HandlePingAsync() in D:\Users\thoms\Documents\GitHub\requestrr\Requestrr.WebApi\RequestrrBot\ChatClients\Discord\DiscordPingWorkFlow.cs:line 23
         at Requestrr.WebApi.RequestrrBot.SlashCommands.Ping(InteractionContext ctx)

is this a misconfiguration with my side or on the discord bot side? this is my first discord bot i have created or set up so i'm not super well versed in setting them up, so i could be missing something

thomst08 commented 4 months ago

Hey @imogen-ooo,

Thank you for reaching out, your right, this might be linked to issue 9, I have seen this happening for others, but not quite like your describing. I have found that something the bot will not connect randomly and then work, I don't think it is a setting you have done, but partly an issue on Discords side, an issue with internet connection or maybe even a random bug. It can be a number of issues that sometime lead to this issue. I have found some people have reset their Bot token and that some times helps, you do this in the Discord Dev Portal, you can try that as it might help, however, you might have the issue again later.

Because this is partly related to issue 9, this should be resolved in the future, but for the moment, I will have to look into it and let you know if I find anything.

imogen-ooo commented 4 months ago

oh awesome, okay i will try to reset the bot token and see if that helps anything, also try poking things around and see if i hit anything or i can solve down to something more specific, thank you!

pseudooriginal commented 2 weeks ago

Hey, anything new about this issue? Any workaround?

thomst08 commented 2 weeks ago

Hey @pseudooriginal,

I don't see this issue happen often, but, when I see 404, it kind of indicates a few things. You could be running an outdated version, you should be on version 2.1.7 as this is the latest. Another issue I see is when the bot is routed through a vpn, as it seems to get blocked on discords side.

These at the two things to check first. Other then that, resetting the bots token can help too

pseudooriginal commented 2 weeks ago

I tried with both latest and dev versions, with network mode host and bridge in docker, but when I wait a certain amount of time it crashes on the first request, after it work. Already 2 bot token reset. I will try to debug later to give more informations about this bug.

pseudooriginal commented 2 weeks ago

It seems to be related with connection between the hosted bot and discord server, I will try to fork and use DeferAsync to see if it is more reliable than CreateResponseAsync.