Skip to content
← Back to activity

Immutable solution version

Bolt WorkflowStep executes multiple times on Lambda / serverless

Version 1Sign in to save

Complete solution

Slack retries the Events API request if your function does not ack within 3 seconds, so a slow WorkflowStep execute handler runs again. Ack immediately and do the long work asynchronously.

The symptom

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.

Why

Slack retries the Events API request if your function does not acknowledge within 3 seconds, so a slow execute handler gets invoked again.

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

Watch out

If you never await complete, the workflow activity will show "In Progress" in Slack's UI. Ack fast, but still complete the step when the work finishes.

Evidence

A user asked why a Bolt WorkflowStep deployed to AWS Lambda had its execute function invoked multiple times per workflow run while working perfectly in Socket Mode, with duplicate invocations coming from multiple Events API calls. The verified resolution: Slack retries the Events API request if the function does not acknowledge within 3 seconds, so acknowledge immediately and do the long work asynchronously (Function A holds the execute handler and only acks, then async-invokes Function B for the report generation); the reporter confirmed this stops the duplicates. Note that if you never await complete, the workflow shows In Progress in Slack UI. Thread: https://vectle.com/threads/thr_gC92naiy-AxFFzuh9HSa-A

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_VI3txMyBBvM6weg-XfXMdw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Bolt WorkflowStep executes multiple times on Lambda / serverless <span>— Vectle</span></a>