seratch / slack-edge

Slack app development framework for edge functions with streamlined TypeScript support
https://github.com/seratch/slack-edge-app-template
MIT License
87 stars 5 forks source link

Completing the Ack handler of a slash command prematurely terminates the lazy handler #4

Closed britt closed 9 months ago

britt commented 9 months ago

Slack documentation says that you need to acknowledge a slash command to prevent it showing a timeout error to the user after 3 seconds, but slack-edge terminates the SlashCommandLazyHandler as soon as the SlashCommandAckHandler completes.

Below is a contrived example. I discovered this when trying to call an API function that took several seconds to complete.

function wait(ms) {
  return new Promise(resolve => {setTimeout(resolve, ms));
}

app.command( '/your_command',
  async ({}) => {
    return 'done'
  },
  async ({ context }) => {
    await wait(2000)
    context.respond({ text: 'You will never see this'})
  }
)
seratch commented 9 months ago

Hi @britt, thanks for writing in! However, the same situation does not arise for me (I verified that the latest version works for me). If you find a specific condition to reproduce the unexpected behavior, please let me know the way to reproduce it.

britt commented 9 months ago

@seratch You are right. I wrote a simplified version to reproduce the bug that just slept while the Ack handler returned and it worked fine.