Worker with Slash-Up Discord Slash Commands Failing
I am currently using slash-create with Cloudflare Workers to integrate Discord Slash commands. I'm getting the below error when I attempt to add the integration on Discord's side.
This all works in local mode, but not on the worker itself (or outside of local mode). I've made some modifications to the boilerplate to get it to run properly. But I never thought to check outside of local mode when I was originally setting up. Happy to share my project if anyone wants to take a look š
Source is here: https://github.com/TristanWiley/procity-slash-commands
Relevant code is most likely in
src/shim/servers/cfworker.ts
and src/shim/creator.ts
. This is where I've been looking. Unfortunately this is code I did not write and are a part of the library itself, however probably outdated a bit.GitHub
GitHub - TristanWiley/procity-slash-commands
Contribute to TristanWiley/procity-slash-commands development by creating an account on GitHub.
8 Replies
Investigated a bit more, looks like this line here is where the last item is being run. So when we get to the
handler
section that's where we fail
Something about the binding probably?
How are you testing locally?
I've not seeb that library before, but if you're still in the early stages and willing to switch, https://github.com/mrbbot/slshx works really great with workers in my experience
GitHub
GitHub - mrbbot/slshx: āļø Strongly-typed Discord commands on Cloudf...
āļø Strongly-typed Discord commands on Cloudflare Workers - GitHub - mrbbot/slshx: āļø Strongly-typed Discord commands on Cloudflare Workers
It feels like the issue is that something is waiting forever on some request and so is triggering that limit. The reason you don't hit that locally is because wrangler uses miniflare for local testing and that merely simulates workers so there are some discrepancies.
Testing locally using
wrangler dev
and using cloudflared
(https://github.com/cloudflare/cloudflared)
I definitely could solve this a lot easier by changing libraries (and I honestly probably will). I just know it's going to bug me if I never figure this out, because I'm so curious what is actually happening you for the library recommendation though! I'll probably migrate to it tonight š the bug is not worth my time as curious as I amYea I totally get that haha. I don't see anything immediately pop out as the cause, but there are a lot of things that could cause an error like this.
Yeah, I'm gonna swap over to the other library now. I mostly was so attached because I spent ages upgrading library and migrating things thank you again
I just realized, I had originally tried slshx but disregarded it since it wouldn't work for me. Turns out the issue was just my node version (found here -> https://discord.com/channels/595317990191398933/799437470004412476/1009374662553260093)
Discord
Discord - A New Way to Chat with Friends & Communities
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.