slash command "dispatch_failed"

Viewed 28779

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

6 Answers

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

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 })

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.

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

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

[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.

Related