slash command "dispatch_failed"
Asked Answered
K

8

36

I have went through creating the custom slash command configuration via slack and installed it on workspace. However when I run it I get this /testing failed with the error "dispatch_failed"

I tried multiple workspaces but same issue. Anyone experienced this?

enter image description here

Klapp answered 31/8, 2020 at 5:12 Comment(2)
I'm also facing the same issue with a slash command that I refactored last week.Cwm
I figured it out. I will post solution to my issueKlapp
K
27

So after a few tests, I found out that this is just a generic message of anything that fails at slack at this point. I have first my endpoint that was unreachable. So it was returning this message. I fixed that, used ngrok for tunnel so that I could debug and that is how I found this issue.

Also, this error can occur due to the following reasons as well.

  • Errors in code
  • Unreachable backend or Invalidly configured slash command in the app
Klapp answered 1/9, 2020 at 1:27 Comment(0)
P
16

While the documentation tells you:

"use the Request URL is your base server link + "/slashcommand" after it"

This is incorrect. The request URL should be: "/slack/events"

Of course the command needs to match whats in the 'edit command' window and in the method '.command' in your app.js:

app.command('/flash-card', async ({ ack, body, client })

Pennon answered 13/1, 2021 at 21:11 Comment(3)
/slack/events part of your answer worked for when I got this errorSholapur
Thank you! I found this answer through github.com/slackapi/bolt-js/issues/579#issuecomment-683998460Cadmarr
To elaborate on what's linked in the issue above - Slack's Bolt framework DOES NOT use /slack/command. It confusingly ONLY uses /slack/events for everything. Bit of a gotcha.Apocope
S
3

This is also the error for a 404 Not Found.

If you're developing offline with ngrok, the 404 error can be seen in the terminal.

If you're deploying with serverless, ensure that you're handling the new endpoint /slack/command. One solution is to create a separate handler, i.e. /command.js

functions:
  slack:
    handler: app.handler
    events:
      - http:
          path: slack/events
          method: post
  command:
    handler: command.handler
    events:
      - http:
          path: slack/command
          method: post
Singlehandedly answered 12/10, 2021 at 16:16 Comment(0)
C
2

If you're using ngrok http <port> to test in your localhost, be aware that a new ngrok public URL is created every time you run this command. So in https://api.slack.com/apps, in your app's Features, you may have to update your Slash Command' request URL with the current ngrok URL generated for you.

Caroylncarp answered 19/3, 2021 at 20:29 Comment(0)
S
1

You need to set the Method in the Integration Settings to GET, is default to POST

Sagittate answered 3/4, 2021 at 0:10 Comment(0)
M
1

[If your code is executing and u still have this error]

In my case using Slackbolt with js I forgot to add

await ack();

in called function so Slack api throw error.

Miterwort answered 27/7, 2022 at 8:21 Comment(0)
E
1

I have been facing the same issue. After searching for a while I got to know that for every slash command, you have to specifically mention the Request URL. You can find it while creating the command or you can reset it by editing the command.

enter image description here

Note: The Request URL should end with /slack/events

Everywhere answered 4/9, 2023 at 6:58 Comment(0)
I
0

In my case I din't include my another command_handler.py file to init, so app could see only those who's already been in init.

Immolate answered 21/11, 2023 at 8:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.