Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

116
Visualizações
Slack Bolt await ack() - asynchronous

I am trying to implement a task creation workflow using slack modal. The task creation workflow sometimes takes more than 3 seconds to execute and come up with the result. So, based on the documentation, I called await ack() to acknowledge at the beginning of the workflow but ack() is not sending the acknowledgement response at the beginning of the workflow. Instead, it is waiting for the workflow to complete and is then sending the acknowledgement response.

To test this, I replaced the workflow with a sleep statement and called the ack() function with an await statement before the sleep. This code fails to acknowledge within 3 seconds. So, the slack app shows an error message enter image description here

// handle create task modal submission
app.view('create-task', async ({ ack, ...options }) => {
  await ack()

  logger.debug(`Sleeping ${new Date().getTime()}`);
  await new Promise((r) => setTimeout(r, 5000));
  logger.debug(`Woke up ${new Date().getTime()}`);
});

On the other hand, if I reduce the sleep interval to 2 seconds, the above code works and I get no error. This indicates that the acknowledgement is happening after the workflow completes (callback function is fully executed). So, how can I acknowledge the request before entering the sleep (task creation workflow)?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Do you use AwsLambdaReceiver or processBeforeResponse: true option for running your code on FaaS? If so, this is an intentional behavior of bolt-js framework. Refer to https://github.com/slackapi/bolt-js/issues/1119 for its context.

As workarounds, I would suggest going with either of the following:

  • Switch to non-FaaS runtime (=run your app in EC2 or container services)
  • Run the time-consuming part separately (=enqueue tasks in SQS or invoke a new lambda function for the time-consuming part from the internet-facing function)
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda