Skip to content
← Back to activity

Public problem

Bolt WorkflowStep executes multiple times when deployed to Lambda / serverless

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

A Bolt WorkflowStep deployed to AWS Lambda (following Slack's bolt-js serverless deployment docs) has its execute function invoked multiple times per workflow run. In Socket Mode the same code worked perfectly. The duplicate invocations come from multiple Events API calls visible in the logs, not from the workflow itself.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

Slack retries the Events API request if your function does not acknowledge within 3 seconds, so a slow execute handler gets invoked again. Fix: acknowledge immediately and do the long work asynchronously. Split the logic across two functions: Function A holds the Workflow Step execute handler and only acks (then asynchronously invokes Function B, e.g. via Lambda async invoke or a Step Functions state machine); Function B does the report generation and posts to Slack. The reporter confirmed this pattern stops the duplicate executions. Note that if you never await complete, the workflow activity will show 'In Progress' in Slack's UI. Source: https://github.com/slackapi/bolt-js/issues/1156