Interactions randomly fail in a dockerized bot

I am not sure if this is inherently a sapphire thing or a discord.js thing but My bot (code found here ) has a weird issue to it where it would occasionally just fail commands entirely https://alex.thefoxesare.online/powershell_vFxRKxUOPM.png without any reason in particular. A recurring problem was when a command I don't have permission to run is run and then any command after it would cause the unknown interaction error to happen, sometimes other interactions. I have never seen this happen in a locally hosted instance so I'm not exactly sure what's happening here. The VPS that the docker instance is on has 2GB of RAM and more than enough CPU and I haven't been hitting any of those limits. After the unknown interaction error, the bot would shut down shortly after. The only other detail I necessarily have is that I'm using global commands and I restarted the bot a few times along with tryong to prun the commands and recreate them but it persists
Solution:
The makeshift solution is to prevent people from executing interactions for like 5 minutes or something. I don't have anything else to give for this particular problem.
Jump to solution
14 Replies
Alex
AlexOP•4w ago
I did not test this by dockerizing on my PC (which probably would've been a smart idea to do instead of on the VPS? Which is a valid thing to test but besides that I haven't really had the problem of commands failing on me like that I wonder if turning the bot off and back on continuously on the VPS lead to some sort of ratelimit type of thing but as far as I know there is a separate kind of error for something like that happening Can it just be written off as "slash commands be slash commands" because of the bot being consecutively restarted
MRDGH2821
MRDGH2821•4w ago
I think that your interactions are timing out really quickly
d.js docs
d.js docs•4w ago
guide suggestion for @Alex: :guide: Slash Commands: Command response methods - Deferred responses read more
MRDGH2821
MRDGH2821•4w ago
More like the VPS is having a slow internet connection🤔 Anyways, if you add deferred responses and still this is a problem, I think that there is some underlying problem in DJS itself🤔
Alex
AlexOP•4w ago
I appreciate it I'll give it a shot
Alex
AlexOP•4w ago
Doesn't look like it
No description
Alex
AlexOP•4w ago
Is it literally all fault of the VPS being slow
MRDGH2821
MRDGH2821•4w ago
Try the same code locally in your PC I checked the code for ping command and it does look correct
Alex
AlexOP•4w ago
Yea it never did that there
MRDGH2821
MRDGH2821•4w ago
You mean, in your local PC, you didn't encounter such problem? If yes, then I suppose that the internet connection or performance of your VM is slow Maybe try in a different VM/VPS?
Alex
AlexOP•4w ago
Yeah, probably the way to go, that's so annoying Oh well, ty
MRDGH2821
MRDGH2821•4w ago
Don't forget to mark solution once your bot starts working
Alex
AlexOP•3w ago
I'm not sure if it is yet :LUL: It seems to be an isue that specifically happens with interactions upon the bot is being freshly restarted. Don't know if there's a specific downtime when discord interactions / application commands just don't respond / exist?
Solution
Alex
Alex•3w ago
The makeshift solution is to prevent people from executing interactions for like 5 minutes or something. I don't have anything else to give for this particular problem.
Want results from more Discord servers?
Add your server